TypeScript 5.5 Adds ECMAScript Set Support
Written by Ian Elliot   
Tuesday, 11 June 2024

TypeScript 5.5 is now available as a release candidate. This version adds support for the proposed ECMAScript Set methods, as well as inferred type predicates and the ability to narrow expressions for flow of control for constant indexed accesses.

TypeScript is a superset of JavaScript that adds optional static types which can be checked by the TypeScript compiler to catch common errors in your programs. TypeScript can use this information to help you avoid about mistakes like typos, missing arguments, or forgetting to check for null and undefined.


TypeScript 5.5 includes support for the new proposed methods for the ECMAScript Set type. This is a proposal to add methods like union and intersection to JavaScript's built-in Set class. Some of the new methods would take one set and return a new set as the result. The other methods would take a set and return a boolean.

There's also new support for inferred type predicates, This extends TypeScript's existing control flow analysis that could be used to deal with undefined variable types so that it can be used with arrays. If you're working with user-defined types, you can now define a function whose return type is a type predicate. It means that if the function returns true, the variable is of the user defined type; if not, it's undefined. The type declarations for Array.prototype.filter know about type predicates, so you get a more precise type and the code passes the type checker rather than an error as happened until now.

This version has also received a number of optimizations for performance and siz, starting with the addition of monomorphized objects in the language service and public API.

TypeScript 5.0 made node and symbol objects have consistent properties with a consistent initialization order, so reducing polymorphism and improving compiler speeds. In TypeScript 5.5, the same monomorphization work has been done for the language service and public API. The developers say they've seen a 5-8% speedup in build times when using the public TypeScript API's allocators, and language service operations getting 10-20% faster.

The overall package size has also been reduced by making tsserver.js and typingsInstaller.js import from a common API library instead of having each of them produce standalone bundles. This reduces TypeScript's size on disk from 30.2 MB to 20.4 MB, and reduces its packed size from 5.5 MB to 3.7 MB.

TypeScript 5.5 is available as a release candidate now.

More Information

TypeScript On NuGet

TypeScript On GitHub

Related Articles

TypeScript 5 - Smaller, Simpler, Faster

TypeScript 4.7 Adds Node.js ECMAScript Module Support

TypeScript 4.6 Improves Constructors

TypeScript 4.5 Adds Awaited

TypeScript 4.4 Improves Control Flow Analysis

TypeScript 4.3 Adds Separate Property Write Types

TypeScript 4.2 Release Candidate Available

New TypeScript Website Launched

TypeScript 4.1 Adds Temporal Literal Types

To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook or Linkedin.

Banner


Hour Of Code 2024 Is About To Kick Off
04/12/2024

This year the event that aims to provide a coding experience for all school students and anyone else who wants to join in runs between December 9th and 15th and includes new activities. Let's find out [ ... ]



Programmer Gifts - Pi For Xmas
13/12/2024

The holiday season is a good time to learn about computers - you have the time. But where to start? Our advice is to ignore the pudding and go for a Pi.


More News

espbook

 

Comments




or email your comment to: comments@i-programmer.info