NodeJs0TypeScript 5.0 retools decorators – Reseller News

[ad_1]

Credit: Dreamstime

Microsoft published a beta release of TypeScript 5.0, the company’s strongly typed JavaScript variant, on January 26. The new release aims to modernise decorators for class customisation.

Decorators, an upcoming ECMAScript feature, allow for customising classes and their members in a reusable way, Microsoft noted in a blog post announcing the release.

Decorators can be used on methods, properties, getters, setters, and auto-accessors. Classes can be decorated for subclassing and registration. While TypeScript previously supported experimental decorators, these were modelled on a much older version of the decorators proposal.

Also in TypeScript 5.0, developers now can add a const modifier to a type parameter declaration to cause const-like inferences to be the default. The update also now allows the extends field to take multiple entries, and it makes all enums union enums by creating a unique type for each computed member. This means all enums can be narrowed and have their members referenced as types.

TypeScript 5.0 features changes across code structure, data structures, and algorithmic extensions, intended to speed up the entire experience of using JavaScript, even installation. Overall, TypeScript 5.0 is intended to make the language smaller, faster, and simpler. A release candidate is expected February 28, followed by general availability of a production release on March 14.



[ad_2]

Source link

Leave a Reply

Your email address will not be published. Required fields are marked *