TypeScript 4.5 expected additions


TypeScript 4.5 was released with enhancements, including type Awaited support, enhancements to support promises, and new snippet completions.

TypeScript is a superset of JavaScript that adds optional static types that can be checked by the TypeScript compiler for common errors in your programs.

The main improvement in TypeScript 4.5 is a new type of utility called Awaited. This can be used to model operations such as the wait in asynchronous functions or the .then () method on promises, and in particular, how they recursively unwrap promises. The developers say the Awaited type can be useful for modeling existing APIs, including built-in JavaScript components like Promise.all and Promise.race.

The next improvement is support for lib from node_modules. This provides a way to override a specific built-in library in a way similar to how @ types / support works, and is designed to overcome problems caused by using declaration files to specify which APIs in JavaScript and the DOM API standard browser that your program should use.

Another improvement means that TypeScript 4.5 can now restrict values ​​that have pattern string types and also recognizes pattern string types as discriminators. TypeScript 4.5 now also provides snippet completions when replacing or implementing methods in classes and for JSX attributes.

type snippets in TypeScript

The new version also has a new feature that performs the elimination of final recursion on conditional types. The team says TypeScript needs a way to gracefully fail when it detects possibly infinite recursion, or any type extension that can take a long time and affect your editing experience. To handle this, TypeScript has heuristics that identify when these problems occur, but some valid types trigger the “potential problem” heuristic. To overcome this, TypeScript 4.5 does some elimination of final recursion on conditional types.

Other improvements include private field presence checks that determine if an object has a private field on it; and import assertions that ensure that an import has an expected format.

TypeScript 4.5 is available now.


More information

TypeScript on NuGet

TypeScript on GitHub

Related Articles

TypeScript 4.4 improves control flow parsing

TypeScript 4.3 adds separate property write types

TypeScript 4.2 Release Candidate available

New TypeScript website launched

TypeScript 4.1 adds types of time literals

TypeScript 3.0 adds project references

TypeScript adds an unused extent report

TypeScript adds conditional types

To be informed of new articles on I Programmer, subscribe to our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook or Linkedin.




or send your comment to: [email protected]


Comments are closed.