TypeScript 5.0 Rebuilds Decorators | Infoworld

Microsoft has released a beta release of TypeScript 5.0. Strongly typed JavaScript variant, January 26. The new release aims to modernize decorators for class customization.

Decorators, an upcoming feature of ECMAScript, allow you to customize classes and their members in a reusable way. Blog post announcing the release. Decorators can be used on methods, properties, getters, setters, and automatic accessors. Classes can be decorated for subclassing and registration. TypeScript previously supported experimental decorators, but these were modeled after a much older version of the decorator proposal.

Also, in TypeScript 5.0, developers can const A modifier to a causative type parameter declaration consInference like t is the default. With this update, extends Use fields to get multiple entries, create a unique type for each calculated member, and make all enums union enums. This means you can narrow down any enum and refer to its members as types.

TypeScript 5.0 features changes across code structure, data structures, and algorithm enhancements aimed at making the overall experience of using JavaScript faster, as well as installation. Overall, TypeScript 5.0 aims to make the language smaller, faster, and simpler. The release candidate is scheduled for February 28th, followed by the general availability of the product release on March 14th.

TypeScript 5.0 Beta includes NuGet Or run the following command:

npm install typescript@beta

Also, in TypeScript 5.0:

  • Improved support for ESM (ECMAScript Module) projects in Node and bundler.
  • Ah –-verbatimModuleSyntax The feature simplifies imports and exports and allows you to maintain imports or exports. type when you drop something with a modifier type modifier.
  • new JSDoc tags, @satisfiesdetects type mismatches while preserving the original type of the expression, allowing developers to more accurately use values ​​in their code. Many developers use his TypeScript to check types in JavaScript code using JSDoc annotations.Also, JSDoc is a new @overload Tag.
  • Correctness changes and deprecations are provided for less frequently used flags.
  • TypeScript is now a target ECMAScript 2018For Node users, this means a minimum version requirement of at least Node.js 10.

TypeScript 5.0 beta follows November release Typescript 4.9, satisfies An operator that catches errors. TypeScript turned 10 October 2022.

Copyright © 2023 IDG Communications, Inc.

https://www.infoworld.com/article/3686509/typescript-50-retools-decorators.html#tk.rss_all TypeScript 5.0 Rebuilds Decorators | Infoworld

Show More
Back to top button