Paul Krill
Editor at Large

TypeScript 4.4 brings performance boosts

news
Aug 16, 20212 mins

Now in a release candidate stage, the next upgrade to Microsoft’s typed JavaScript also introduces control flow analysis and spelling suggestions in plain JavaScript files.

mechanic overhauling engine
Credit: Thinkstock

Microsoft’s TypeScript 4.4, the latest planned version of its popular typed version of JavaScript, has moved to a release candidate stage, with capabilities including performance improvements and control flow analysis.

No further changes are expected in the release apart from critical bug fixes.

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 normalization and path mapping, along with faster incremental builds. An optimization has been added for source map generation of very large output files, and faster --force builds are offered as well. A -- force build does not need up-to-date checks to determine which files need to be rebuilt, with project dependencies rebuilt from scratch.

The TypeScript 4.4 release candidate, published August 12, can be accessed through NuGet or via NPM:

npm install typescript@rc

General availability of TypeScript 4.4 is planned for August 24. The beta release was published July 1. Other new capabilities in TypeScript 4.4:

  • 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 appropriately. 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 provides support for inlay hints, which can display information such as parameter names and return types 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.
  • With static blocks in classes, developers can write more complex initialization code for static members.

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.

Paul Krill

Paul Krill is editor at large at InfoWorld. Paul has been covering computer technology as a news and feature reporter for more than 35 years, including 30 years at InfoWorld. He has specialized in coverage of software development tools and technologies since the 1990s, and he continues to lead InfoWorld’s news coverage of software development platforms including Java and .NET and programming languages including JavaScript, TypeScript, PHP, Python, Ruby, Rust, and Go. Long trusted as a reporter who prioritizes accuracy, integrity, and the best interests of readers, Paul is sought out by technology companies and industry organizations who want to reach InfoWorld’s audience of software developers and other information technology professionals. Paul has won a “Best Technology News Coverage” award from IDG.

More from this author