TypeScript 5.5, now in a release candidate, also features inferred type predicates, regular expression syntax checking, and performance and size optimizations. Credit: David Lofink TypeScript 5.5, the latest version of Microsoft’s strongly typed JavaScript variant, has graduated to a release candidate (RC) stage. The update, which brings improvements ranging from performance and size optimizations to regular expression checking, recently added support for ECMAScript’s new Set methods. The TypeScript 5.5 release candidate was introduced June 6 and can be accessed through Nuget or the following command: npm -D typescript@rc. A beta release was introduced April 25 and the final release is planned for June 18. 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 has been 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 features 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 analysis Beyond the usual suspects: 5 fresh data science tools to try today The mid-month report includes quick tips for easier Python installation, a new VS Code-like IDE just for Python and R users, and five newer data science tools you won't want to miss. By Serdar Yegulalp Jul 12, 2024 2 mins Python Programming Languages Software Development analysis Generative AI won’t fix cloud migration You’ve probably heard how generative AI will solve all cloud migration problems. It’s not that simple. Generative AI could actually make it harder and more costly. By David Linthicum Jul 12, 2024 5 mins Generative AI Artificial Intelligence Cloud Computing news HR professionals trust AI recommendations HireVue survey finds 73% of HR professionals trust AI to make candidate recommendations, while 75% of workers are opposed to AI making hiring decisions. By Paul Krill Jul 11, 2024 3 mins Technology Industry Careers how-to Safety off: Programming in Rust with `unsafe` What does it mean to write unsafe code in Rust, and what can you do (and not do) with the 'unsafe' keyword? The facts may surprise you. By Serdar Yegulalp Jul 11, 2024 8 mins Rust Programming Languages Software Development Resources Videos