Typescript 2.9 release candidate is here

2 min read

The release candidate for Typescript 2.9 is here! Typescript is an open-source programming language which adds optional static typing to Javascript. Let’s jump into some highlights of Typescript 2.9 RC.

Changes to keyof operator

TypeScript 2.9 changes the behavior of keyof to factor in both unique symbols as well as numeric literal types. TypeScript’s keyof operator is a useful way to query the property names of an existing type. Before Typescript 2.9, keyof never recognized symbolic keys.

With this functionality, mapped object types like Partial, Required, or Readonly can also recognize symbolic and numeric property keys, and no longer drop properties named by symbols.

Introduction of new import( ) type syntax

One long-running pain-point in TypeScript has been the inability to reference a type in another module, or the type of the module itself, without including an import at the top of the file. With Typescript 2.9, their is a new import(…) type syntax.

import types use the same syntax as ECMAScript’s proposed import(…) expressions, and provide a convenient way to reference the type of a module, or the types which a module contains.

Trailing commas not allowed on rest parameters

This break was added for conformance with ECMAScript, as trailing commas are not allowed to follow rest parameters in the specification.

Changes to strictNullChecks

Unconstrained type parameters are no longer assignable to object in strictNullChecks. Since generic type parameters can be substituted with any primitive type, this is a precaution TypeScript has added under strictNullChecks. To fix this, you can add a constraint on object.

never can no longer be iterated over

Values of type never can no longer be iterated over. Users can avoid this behavior by using a type assertion to cast to the type any.

The list of entire changes and code files can be found on the Microsoft blog. You can also view the TypeScript roadmap for everything else that’s coming in 2.9 and beyond.

Read Next

How to install and configure TypeScript

How to work with classes in Typescript

Tools in TypeScript

Sugandha Lahoti
Content Marketing Editor at Packt Hub. I blog about new and upcoming tech trends. In my free time, you can find me humming songs and hunting for new novels to read.

Share this post


G Suite administrators’ passwords were unhashed for 14 years, notifies Google

Today, Google notified its G Suite administrators that some of their passwords were being stored in an encrypted internal system unhashed, i.e., in plaintext,...