You are here: Home » NewsFeeds » TypeScript 2.9 is now available

TypeScript 2.9 is now available

TypeScript 2.9 adds support for number and symbol named properties in index types and mapped types.
Previously, the keyof operator and mapped types only supported string named properties.

Changes include:

An index type keyof T for some type T is a subtype of string | number | symbol.
A mapped type { [P in K]: XXX } permits any K assignable to string | number | symbol.
In a for…in statement for an object of a generic type T, the inferred type of the iteration variable was previously keyof T but is now Extract. (In other words, the subset of keyof T that includes only string-like values.)
Given an object type X, keyof X is resolved as follows:

If X contains a string index signature, keyof X is a union of string, number, and the literal types representing symbol-like properties, otherwise
If X contains a numeric index signature, keyof X is a union of


 

Original article