Microsoft Releases Beta of Next-Gen TypeScript 6.0
Microsoft has announced a beta release of TypeScript 6.0, the latest version of its popular strongly typed JavaScript superset. This update is significant because it’s expected to be the final release based on the current JavaScript codebase before a major overhaul. The company is also preparing for TypeScript 7.0, which will feature a new compiler and language service built in Go for improved speed and scalability.
TypeScript 6.0 Beta Now Available for Developers
Developers can try out TypeScript 6.0 beta today by installing it through npm with the command npm install -D typescript@beta. Microsoft has scheduled the official production release for March 17, with a release candidate expected on February 24. This beta version introduces a new flag, –stableTypeOrdering, which helps with migrating code to the upcoming TypeScript 7.0. The flag aligns type ordering behavior with the new Go-based compiler, making the transition smoother.
According to Microsoft’s Daniel Rosenwasser, the TypeScript team is working on a new codebase written in Go. This move aims to leverage native code’s speed and shared-memory multi-threading to boost performance. TypeScript 6.0 acts as a bridge, helping developers prepare for the more significant changes coming with TypeScript 7.0. Most of the updates in 6.0 are focused on aligning the codebases and easing the migration process.
New Features and Improvements in TypeScript 6.0
One notable addition is support for the es2025 target and lib options. This allows developers to take advantage of new built-in APIs, such as RegExp.escape, and move declarations from esnext into es2025. Functions that use the -less flag now handle context sensitivity more efficiently. If a function never uses the this keyword, it is no longer considered contextually sensitive, improving type inference accuracy.
Another major update is the inclusion of support for the ECMAScript Temporal API, which is expected to be adopted into JavaScript soon. TypeScript 6.0 now provides built-in types for Temporal, enabling developers to work with dates and times more reliably. This feature can be used with the –target esnext or by specifying “lib”: [“esnext”] in the configuration, making temporal data handling more straightforward in TypeScript projects.
Additionally, TypeScript 6.0 introduces new types for “upsert” methods. These methods, such as getOrInsert and getOrInsertComputed, are part of the ECMAScript proposal that recently reached stage 4. They extend Map and WeakMap objects, allowing more flexible data management. These new methods are added to the esnext library, giving developers more tools for working with collections.
Overall, TypeScript 6.0 marks an important step forward, not just in features but also in laying the groundwork for a major transition to the new Go-based compiler in TypeScript 7.0. While some features, like the –stableTypeOrdering flag, can slow down type checking if used extensively, they are key for ensuring a smooth migration. Developers are encouraged to test the beta and prepare for the upcoming release, which promises to bring significant improvements in performance and capabilities.















What do you think?
It is nice to know your opinion. Leave a comment.