Menu
TypeScript 4.4 brings performance boosts

TypeScript 4.4 brings performance boosts

Due in late August, upgrade to Microsoft’s typed JavaScript also introduces control flow analysis and spelling suggestions in plain JavaScript files.

Credit: TypeScript

Microsoft has released a beta version of TypeScript 4.4, the latest planned version of its popular typed version of JavaScript, with capabilities including performance improvements and control flow analysis.

For faster declaration emits, TypeScript now caches whether internal symbols are accessible in different contexts, along with how specific types are to be printed. This improves general performance in code with fairly complex types.

Other performance enhancements in TypeScript 4.4 promise faster path normalisation and path mapping, along with faster incremental builds. Also, an optimisation has been added for source map generation of very large output files.

The TypeScript 4.4 beta can be access through NuGet or via NPM:

npm install typescript@beta

General availability of TypeScript 4.4 is planned for late August, following a release candidate earlier in the month.

Meanwhile for control flow analysis of aliased conditions, when TypeScript sees that a constant value is being tested, it will do extra work to see if it has a type guard. If the type guard operates on a const, a readonly property, or an unmodified parameter, then TypeScript is able to narrow that value property. Different type guard conditions are preserved, not just typeof checks.

Other new capabilities in TypeScript 4.4 include spelling suggestions which are now issued in plain JavaScript files. These suggestions can provide a clue that code is wrong.

In addition, TypeScript 4.4 is experimenting with editor support for inlay text, which can display information such as parameter names inline in code while index signatures for symbols and template string patterns now are permitted.

Delving deeper, a new flag, --useUnknownInCatchVariables, changes the default type of catch clause variables from any to unknown. Another new flag, --exactOptionalPropertyTypes, specifies that optional property types should be interpreted exactly as written.

TypeScript 4.4 follows the May introduction of the production release of TypeScript 4.3. Among other improvements, the TypeScript 4.3 release allowed developers to specify types for reading and writing to properties.


Tags MicrosoftTypeScript

Brand Post

Show Comments