Close

TypeScript 5.5 Beta Unveiled with Notable Enhancements

Microsoft’s TypeScript, a robust variant of JavaScript with strong typing, is set to undergo significant improvements in its upcoming 5.5 release, now available in beta. This iteration introduces various enhancements, spanning from performance and size optimizations to the introduction of syntax checking for regular expressions.

The TypeScript 5.5 beta was announced on April 25, accessible via Nuget or by utilizing the npm command: npm -D typescript@beta. Anticipated milestones include a release candidate slated for June 4, with the final release expected on June 18.

Among the notable enhancements in TypeScript 5.5 is the optimization effort aimed at boosting performance and reducing package size. Monomorphization work has been conducted for both the language service and public API, promising quicker editor experiences and build tool operations employing the TypeScript API. This optimization aligns with previous endeavors in TypeScript 5.0, which focused on ensuring consistent property sets and initialization orders for Node and Symbol objects.

Furthermore, TypeScript 5.5 boasts a significant reduction in package size, with the disk footprint shrinking from 30.2 MB to 20.4 MB and the packed size decreasing from 5.5 MB to 3.7 MB. As part of the ongoing effort to enable isolatedDeclarations, TypeScript’s handling of source code replication when producing declaration files has been enhanced.

Introducing basic syntax checking for regular expressions is another highlight of TypeScript 5.5. Prior to this release, TypeScript often overlooked regular expressions due to their extensible grammar, resulting in undetected issues within codebases.

Moreover, TypeScript 5.5 enhances the language’s ability to infer type predicates under specific conditions, along with improving control flow narrowing for constant indexed accesses. This improvement enables more precise expression narrowing when both the object and key are effectively constant.

Facilitating ECMAScript module consumption, TypeScript 5.5 now supports named imports from the typescript package when developing ECMAScript modules in Node.js. Additionally, a new @import comment tag has been introduced, mirroring the syntax of ECMAScript imports.

Another notable addition is the transpileDeclaration API, aimed at generating a single declaration file based on input source text, resembling the functionality of transpileModule for compiling individual TypeScript code files.

TypeScript 5.5 builds upon the foundation laid by TypeScript 5.4, which introduced preserved narrowing within function closures earlier this year.