TypeScript 5.2 arrived August 24, according to a Microsoft bulletin. It follows an August 9 release candidate and a beta phase that began June 30.
Symbol.dispose. For convenience, TypeScript defines a new global type called
Since the release candidate (RC), Microsoft documented three additions to TypeScript 5.2: copying array methods, the ability to use symbols as
WeakSet keys, and clickable inlay parameter hints, which provide parameter definitions at a glance. The release also documents a “small” breaking change around always emitting the namespace keyword in declaration files.
With the RC, Microsoft had added optimized checks for ongoing type compatibility and the ability to reference the paths of TypeScript implementation files in type-only imports.
The TypeScript 5.2 release candidate can be accessed through NuGet or via NPM:
npm install -D typescript
Previously cited new capabilities in TypeScript 5.2:
- Decorator metadata, also an upcoming ECMAScript feature, is intended to make it easy for decorators to create and consume metadata on any class they are used on or within.
- An all-or-nothing restriction on the use of tuple labels has been lifted. The language now can preserve labels when spreading into an unlabeled tuple.
- Object member completions are provided when a comma is missing. Previously, if a comma were forgotten and auto-completion requested, TypeScript would confusingly give unrelated completion results.
- Easier method usage for unions of arrays means that methods like
reducecan be invoked on unions of arrays in cases where they previously did not work.
- A refactoring has been added to inline the contents of a variable to all usage sites. Using the “inline variable” refactoring will eliminate the variable and replace all the variable’s usages with its initializer.
Copyright © 2023 IDG Communications, Inc.