Microsoft Announces TypeScript 4.2 RC

Between RC and the stable release of TypeScript 4.2, there will be no further changes apart from critical bug fixes.

Recently, Microsoft announced the Release Candidate of TypeScript 4.2 that brings a bunch of new features and enhancements to TypeScript.

Microsoft said that between RC and the stable release of TypeScript 4.2, it expects no further changes apart from critical bug fixes.

TypeScript 4.2 RC features Leading/Middle Rest Elements in Tuple Types; Smarter Type Alias Preservation; Stricter Checks For The in Operator; --explainFiles; Improved Uncalled Function Checks in Logical Expressions; Relaxed Rules Between Optional Properties and String Index Signatures; and more.

You can get RC through NuGet, or using npm: npm install typescript@rc

In TypeScript 4.2, rest elements haave been expanded in how they can be used, they can now occur anywhere within a tuple – with only a few restrictions. Earlier they were only allowed at the very last position of a tuple type. A rest element can be placed anywhere in a tuple, so long as it’s not followed by another optional element or rest element.

Source: Microsoft

In TypeScript 4.2, the internals are a little smarter. 4.2 keep track of how types were constructed by keeping around parts of their original structures, before normalizing them. 

The ability to print back the types based on how you used them in your code means that you can avoid some unfortunately humongous types getting displayed. This often translates to getting better .d.ts file output, error messages, and in-editor type displays in quick info and signature help.

TypeScript is also introducing a new flag called --noPropertyAccessFromIndexSignature. Under this mode, you’ll be opted in to TypeScript’s older behavior that issues an error. The setting is not under the strict family of flags.

TypeScript 4.2 also enables you to specify an abstract modifier on constructor signatures. Adding the abstract modifier to a construct signature signals that you can pass in abstract constructors. The feature enables you to write mixin factories in a way that supports abstract classes. 

For additional details, you can visit the official announcement here.



Next Recommended Reading TypeScript 4.2 Beta Released