TypeScript 6.0 marks the final release leveraging the existing JavaScript codebase, preceding the introduction of a Go-powered compiler and language service in TypeScript 7.0.
<div class="media-with-label__label">
Image credit: spr / Shutterstock </div>
</figure>
</div>
</div>
</div>
</div>
Microsoft has unveiled a beta version of TypeScript 6.0, an upcoming iteration of the company’s strongly typed JavaScript dialect. This release is positioned as the final one to be built upon the existing JavaScript codebase. Future versions, starting with TypeScript 7.0, are slated to feature a compiler and language service entirely rewritten in Go, aiming for enhanced performance and improved scalability.
The beta for TypeScript 6.0 was announced on February 11. Developers can install it via npm using the command npm install -D typescript@beta. The official production launch for TypeScript 6.0 is scheduled for March 17, with a release candidate expected on February 24.
A notable addition in TypeScript 6.0 is the new --stableTypeOrdering flag, designed to aid in the transition to the forthcoming Go-based TypeScript 7.0. “As previously announced last year (with recent updates available here), we are developing a new foundation for the TypeScript compiler and language service in Go, which will leverage native code speed and shared-memory multi-threading,” stated Daniel Rosenwasser, Microsoft’s principal product manager for TypeScript, in the blog post introducing the beta. Rosenwasser elaborated that TypeScript 6.0 will largely serve as a transitional release between TypeScript 5.9 and TypeScript 7.0. “Consequently, most modifications in TypeScript 6.0 are aimed at facilitating alignment and preparation for TypeScript 7.0 adoption.” However, he noted that some new features and enhancements are included beyond mere alignment.
TypeScript 6.0 also introduces support for the es2025 option for both `target` and `lib` configurations, decreased contextual sensitivity for `this`-less functions, and new types for the `Temporal` API, which offers standardized objects and functions for handling dates and times. The `–stableTypeOrdering` flag ensures that TypeScript 6.0’s type ordering behavior aligns with that of TypeScript 7.0, thereby minimizing discrepancies between the two codebases. Microsoft advises against constant use of this flag due to potential significant slowdowns in type checking, which could reach up to 25% depending on the project.
With TypeScript 6.0’s es2025 option, the updated target includes new types for intrinsic APIs (like RegExp.escape) and transitions several declarations from `esnext` to `es2025`. For functions without `this`, if `this` is never actually utilized within a function, it is no longer deemed contextually sensitive. This results in these functions receiving higher priority during type inference. Regarding `Temporal`, Rosenwasser noted that the long-anticipated ECMAScript Temporal proposal has advanced to stage 3 and is anticipated for inclusion in JavaScript soon. TypeScript 6.0 now integrates built-in types for the Temporal API, allowing developers to begin using it in TypeScript code by setting --target esnext or "lib": ["esnext"], or by specifying `temporal.esnext` for more granular control.
Additional enhancements and capabilities within TypeScript 6.0 include:
- New type definitions have been incorporated for “upsert” functionalities. The ECMAScript “upsert” proposal, which recently reached stage 4, introduces two novel methods for `Map` and `WeakMap` objects. These include `getOrInsert` or `getOrInsertComputed`. These methods are now part of the `esnext` library, enabling immediate use in TypeScript 6.0.
- The
RegExp.escapemethod, useful for escaping special regular expression characters such as *, ?, and +, is now part of the `es2025` library and can be utilized in TypeScript 6.0. - The declarations found in
lib.dom.iterable.d.tsandlib.dom.asynciterable.d.tsare now fully integrated intolib.dom.d.ts. TypeScript’s `lib` option empowers developers to specify the global declarations available in a given runtime environment.
@font-face&lt;br> {font-family:Wingdings;&lt;br> panose-1:5 0 0 0 0 0 0 0 0 0;&lt;br> mso-font-charset:77;&lt;br> mso-generic-font-family:decorative;&lt;br> mso-font-pitch:variable;&lt;br> mso-font-signature:3 0 0 0 -2147483647 0;}@font-face&lt;br> {font-family:”Cambria Math”;&lt;br> panose-1:2 4 5 3 5 4 6 3 2 4;&lt;br> mso-font-charset:0;&lt;br> mso-generic-font-family:roman;&lt;br> mso-font-pitch:variable;&lt;br> mso-font-signature:-536870145 1107305727 0 0 415 0;}@font-face&lt;br> {font-family:Aptos;&lt;br> panose-1:2 11 0 4 2 2 2 2 2 4;&lt;br> mso-font-charset:0;&lt;br> mso-generic-font-family:swiss;&lt;br> mso-font-pitch:variable;&lt;br> mso-font-signature:536871559 3 0 0 415 0;}p.MsoNormal, li.MsoNormal, div.MsoNormal&lt;br> {mso-style-unhide:no;&lt;br> mso-style-qformat:yes;&lt;br> mso-style-parent:””;&lt;br> margin-top:0in;&lt;br> margin-right:0in;&lt;br> margin-bottom:8.0pt;&lt;br> margin-left:0in;&lt;br> line-height:115%;&lt;br> mso-pagination:widow-orphan;&lt;br> font-size:12.0pt;&lt;br> font-family:”Aptos”,sans-serif;&lt;br> mso-ascii-font-family:Aptos;&lt;br> mso-ascii-theme-font:minor-latin;&lt;br> mso-fareast-font-family:Aptos;&lt;br> mso-fareast-theme-font:minor-latin;&lt;br> mso-hansi-font-family:Aptos;&lt;br> mso-hansi-theme-font:minor-latin;&lt;br> mso-bidi-font-family:”Times New Roman”;&lt;br> mso-bidi-theme-font:minor-bidi;&lt;br> mso-font-kerning:1.0pt;&lt;br> mso-ligatures:standardcontextual;}a:link, span.MsoHyperlink&lt;br> {mso-style-priority:99;&lt;br> color:#467886;&lt;br> mso-themecolor:hyperlink;&lt;br> text-decoration:underline;&lt;br> text-underline:single;}a:visited, span.MsoHyperlinkFollowed&lt;br> {mso-style-noshow:yes;&lt;br> mso-style-priority:99;&lt;br> color:#96607D;&lt;br> mso-themecolor:followedhyperlink;&lt;br> text-decoration:underline;&lt;br> text-underline:single;}p&lt;br> {mso-style-priority:99;&lt;br> mso-margin-top-alt:auto;&lt;br> margin-right:0in;&lt;br> mso-margin-bottom-alt:auto;&lt;br> margin-left:0in;&lt;br> mso-pagination:widow-orphan;&lt;br> font-size:12.0pt;&lt;br> font-family:”Times New Roman”,serif;&lt;br> mso-fareast-font-family:”Times New Roman”;}code&lt;br> {mso-style-noshow:yes;&lt;br> mso-style-priority:99;&lt;br> font-family:”Courier New”;&lt;br> mso-ascii-font-family:”Courier New”;&lt;br> mso-fareast-font-family:”Times New Roman”;&lt;br> mso-hansi-font-family:”Courier New”;&lt;br> mso-bidi-font-family:”Courier New”;}.MsoChpDefault&lt;br> {mso-style-type:export-only;&lt;br> mso-default-props:yes;&lt;br> font-family:”Aptos”,sans-serif;&lt;br> mso-ascii-font-family:Aptos;&lt;br> mso-ascii-theme-font:minor-latin;&lt;br> mso-fareast-font-family:Aptos;&lt;br> mso-fareast-theme-font:minor-latin;&lt;br> mso-hansi-font-family:Aptos;&lt;br> mso-hansi-theme-font:minor-latin;&lt;br> mso-bidi-font-family:”Times New Roman”;&lt;
window.NREUM||(NREUM={});NREUM.info={“beacon”:”bam.nr-data.net”,”licenseKey”:”NRJS-51503b5fb963bca6c59″,”applicationID”:”1486670290″,”transactionName”:”NAZXbBAAXRZUU00KXA1MdFsWCFwLGkNQDVQPBhhIDRJH”,”queueTime”:0,”applicationTime”:407,”atts”:”GEFAGlgaTkkXURtZSB4e”,”errorBeacon”:”bam.nr-data.net”,”agent”:””}