TypeScript 4.5 Begins Improving Promises

Read Time:2 Minute, 8 Second

The latest publicly available version of TypeScript, Microsoft’s strongly typed JavaScript language, introduces another Awaited type to model Promise recursions. On the other hand, support for the ECMAScript module for Node.js has been postponed to a later version.

The last

TypeScript 4.5, the latest update to Microsoft’s JavaScript-based strongly typed language, is now available to everyone. The version has a type called Awaited which models operations of the kind await in asynchronous functions or method .then() on objects Promise. However, support for ECMAScript modules in Node.js 12, a feature introduced in the TypeScript 4.5 beta and originally planned for the release, has been delayed to a later release.

Node.js, which can work with TypeScript, has worked on support for ECMAScript Modules (ESM) in order to package JavaScript code for reuse. But “this work was difficult because Node.js was built on a different module system, CommonJS,” Microsoft explained. However ESM has been widely implemented in Node.js 12.

Other developments

TypeScript 4.5 brings several other innovations:

– Added performance regression in mode –build due to calls realpath excessive for JSON files.

– The release version introduces a solution to easily replace a specific built-in library to better support the parameter lib from node_modules.

– To improve speed, a native implementation of the function realpathSync of Node.js is now used on all operating systems. Previously, it was limited to Linux. It has now been adapted to generally case-sensitive operating systems, such as Windows and MacOS.

– Supplements of the type snippet are offered for JSX attributes.

– An ECMAScript proposal to check if an object has a private field is supported. Another ECMAScript proposal, for Import Assertions, is also supported. This syntax is used by runtimes to ensure that an import is in the expected format.

– Better editor support is offered for unresolved types.

– Values ​​with pattern strings can be reduced. Also, pattern strings are recognized as classifiers.

– A new module parameter called es2022, is supported, providing a await high-level, which means that developers can use await apart from asynchronous functions.

– Some removal of tail recursion is done on conditional types.

– Part of TypeScript 4.5 allows a type modifier on named individual imports.

TypeScript builds on JavaScript by adding syntax for static types. The previous version, TypeScript 4.4, has been available to everyone since August.

TypeScript 4.5 reached the release stage on November 2. The latest version of the language is fully available since November 17. Developers can install TypeScript 4.5 via NuGet or via NPM: npm install typescript.

Happy
Happy
0 %
Sad
Sad
0 %
Excited
Excited
0 %
Sleepy
Sleepy
0 %
Angry
Angry
0 %
Surprise
Surprise
0 %
Mobile Functions In Windows Insider But For Samsung Only Previous post Mobile functions in Windows Insider but for Samsung only
Gitguardian Warns Against Shared Source Code Next post GitGuardian warns against shared source code