TypeScript 5.5 brings inferred type predicates, regular expression syntax checking, performance optimizations, and support for ECMAScript Set methods. Credit: Daboost/Shutterstock TypeScript 5.5, the latest version of Microsoft’s strongly typed JavaScript variant, has been officially released. The update brings improvements ranging from performance and size optimizations to regular expression checking, and adds support for ECMAScript’s new Set methods. TypeScript 5.5 was released June 20 and can be accessed through Nuget or the following command: npm -D typescript. A beta release was introduced April 25 and a release candidate arrived for June 6. Since the release candidate (RC), Microsoft has temporarily reverted a change that consulted package.json to determine a given file’s module format. Feedback indicated that this change disrupted workflows and caused an unexpected amount of file-watching pressure for larger projects. In TypeScript 5.6, Microsoft hopes to bring back a more-nuanced version of this feature while looking into optimizations on how to watch for non-existent files. Since the beta, TypeScript 5.5 added support for the new Set methods proposed for JavaScript. Some of these methods, such as union, intersection, and difference, take another Set and return a new Set as the result. Other methods, such as isSubsetOf, take another Set and return a boolean. Also new in the release candidate, TypeScript’s regular expression checking was made slightly more lenient while still erroring on questionable escapes that are allowed only per ECMAScript’s Annex B. The TypeScript 5.5 RC also featured more performance optimizations, including skipped checking in transpileModule and optimizations in filtering contextual types that can lead to faster build and iteration times. TypeScript 5.5 includes numerous other improvements that were previously available in the beta release. For performance and size, monomorphization work has been done for the language service and public API. With monomorphism, the editor experience and build tools using the TypeScript API will get faster, TypeScript’s authors said. This was the same work previously done for Node and Symbol objects in TypeScript 5.0 to ensure they had a consistent set of properties with a consistent initialization order. TypeScript 5.5 also features a significant reduction in overall package size. The disk footprint has been reduced from 30.2 MB to 20.4 MB, and the packed size from 5.5 MB to 3.7 MB. As part of work to enable isolatedDeclarations, Microsoft has improved how often TypeScript can directly copy input source code when producing declaration files. TypeScript 5.5 introduces basic syntax checking on regular expressions. Until now, TypeScript typically skipped over most regular expressions in code, because regular expressions technically have an extensible grammar and TypeScript never made an effort to compile regular expressions to earlier versions of JavaScript. This meant common problems would go undiscovered in regular expressions. With TypeScript 5.5, TypeScript will now infer that a function returns a type predicate under certain conditions. And with control flow narrowing for constant indexed accesses, TypeScript now is able to narrow expressions in for obj[key] when both obj and key are effectively constant. TypeScript 5.5 makes API consumption of ECMAScript modules easier. Previously, if a developer was writing an ECMAScript module in Node.js, named imports were not available from the typescript package. This has been fixed. TypeScript also now supports a new @import comment tag that has the same syntax as ECMAScript imports. TypeScript 5.5 also adds a transpileDeclaration API, which is designed to generate a single declaration file based on input source text. The API is similar to transpileModule for compiling a single file of TypeScript code. TypeScript 5.5 follows TypeScript 5.4, which became generally available in March and brought preserved narrowing within function closures. Related content news TypeScript 5.7 improves error reporting Microsoft’s strongly typed JavaScript is now in the release candidate stage, featuring error reporting for variables that were never initialized. By Paul Krill Nov 13, 2024 3 mins JavaScript Typescript Programming Languages news JetBrains offers free use of WebStorm and Rider IDEs New licenses make JetBrains’ JavaScript/TypeScript and .NET/game development environments free to use for open-source projects and other non-commercial purposes. By Paul Krill Oct 24, 2024 2 mins Integrated Development Environments JavaScript Microsoft .NET news Next.js 15 arrives with faster bundler High-performance Rust-based Turbopack bundler moves from beta to stable with the latest update of the React-based web framework. By Paul Krill Oct 24, 2024 2 mins JavaScript React Web Development news Deno 2.0 arrives, ready to battle Node.js Major update to the Deno runtime for JavaScript, TypeScript, and WebAssembly is backward compatible with Node.js and stabilizes the standard library. By Paul Krill Oct 09, 2024 3 mins JavaScript Node.js Web Development Resources Videos