This capability was planned for TypeScript 4.5 when the beta was revealed on October 1, but has been deferred to a future release. Meanwhile, it will be available only under an experimental flag in nightly releases. Concerns around ecosystem readiness and general guidance on using the feature prompted the postponement.
TypeScript 4.5 reached the release candidate stage on November 2 and is slated to be generally available on November 16.
Also new in TypeScript 4.5:
- A performance regression has been added in
--buildmode due to excessive
realpathcalls for JSON files.
- The release introduces an easy way to override a specific built-in
libto better support the
- To improve speed, a system-native implementation of the Node.js
realpathSyncfunction is now leveraged on all operating systems. Previously, it was limited to Linux. Now it has been adapted to OSes that are typically case-sensitve, like Windows and MacOS.
- Snippet completions are offered for JSX attributes.
- An ECMAScript proposal for checking whether an object has a private field is supported. Another ECMAScript proposal, for import assertions, also is supported. This is a syntax used by runtimes to ensure that an import has an expected format.
- Better editor support is offered for unresolved types.
- A utility type, the
Awaitedtype, is introduced for modeling operations like
asyncfunctions or the
Awaitedcan be useful for modeling existing APIs.
- Values that have template strings can be narrowed. Also, template strings are recognized as discriminants.
- A new
es2022, is supported, providing top-level
await, meaning developers can use
- Some tail-recursion elimination is performed on conditional types.
- Part of TypeScript 4.5 allows a
typemodifier on individual named imports.
Copyright © 2021 IDG Communications, Inc.