TypeScript 4.4 is Officially Released

TypeScript 4.4 is Officially Released
Photo by Raphael Schaller / Unsplash

Microsoft has just released a beta preview of it's popular typed version of JavaScript with control flow analysis and some good performance improvements.

TypeScript can now cache whether internal symbols are accessible in different types of contexts – along with how specific types are printed. This will overall improve performance in code with complex types. Other notable performance enhancements in the newest beta promises faster path normalization and path mapping. There is also faster incremental builds. Also, an optimization has been added for source map generation.

The new beta release can be installed via the Node Package Manager (NPM).

npm install typescript@beta

The gold release is planned for late August right now. Right now they are planning a Release Cadidate around the 1st of August.

Other notable changes in TypeScript 4.4 release:

  • 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.
  • Spelling suggestions now are issued in plain JavaScript files. These suggestions can provide a clue that code is wrong.
  • TypeScript 4.4 is experimenting with editor support for inlay text, which can display information such as parameter names inline in code.
  • Index signatures for symbols and template string patterns now are permitted.
  • 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 production release of TypeScript 4.3 that came out just this last May. Among the other improvements in the last release, the TypeScript 4.3 release allowed developers to specify types for reading and writing to properties.