TypeScript 5.2 has been officially released.
5.2 New Features
using
Declarations and Explicit Resource Management (using Declarations and Explicit Resource Management)- Decorator Metadata
- Named and Anonymous Tuple Elements
- Easier Method Usage for Unions of Arrays
- Comma Completions for Object Members
- Optimize Ongoing Type Compatibility
- Inline Variable Refactoring
TypeScript 5.2 implements an upcoming ECMAScript feature called decorator metadata. The key idea of this feature is to make it easy for a decorator to create and use metadata on any class it uses.
Whenever decorator functions are used, they now have access to new metadata
properties of their context object. metadata
Properties just contain a simple object. Since JavaScript allows us to add properties arbitrarily, it can be used as a dictionary that is updated by each decorator.
Alternatively, since each metadata
object is the same for each decorated part of the class, it can be used as Map
a key for . After all decorators on or in the class have run, Symbol.metadata
the object can be accessed via on the class.
Since the TypeScript 5.2 RC release, the documentation has added Copying Array Methods , symbol
s as WeakMap
, WeakSet
Keys and Clickable Inlay Parameter Hintsnamespace
, as well as an important change about always hinting keywords in declaration files .