TypeScript 6.0 RC Announced: Final Release Before Major Go-Based Rewrite
#Regulation

TypeScript 6.0 RC Announced: Final Release Before Major Go-Based Rewrite

Startups Reporter
4 min read

Microsoft's TypeScript team has released the 6.0 Release Candidate, marking the last version based on the current JavaScript codebase before a significant rewrite in Go for version 7.0. This release introduces several new features while also deprecating numerous options to align with modern JavaScript development practices.

The TypeScript team at Microsoft has announced the Release Candidate (RC) of TypeScript 6.0, a pivotal release that serves as both a feature update and a bridge to the upcoming TypeScript 7.0, which will be built on a completely new Go-based codebase. This marks a significant transition in the evolution of the popular JavaScript superset language.

What makes TypeScript 6.0 particularly noteworthy is its position as the final release based on the current JavaScript codebase. As announced last year with recent updates, the team is working on a new TypeScript compiler and language service written in Go that will leverage native code performance and shared-memory multi-threading capabilities. This architectural shift promises substantial performance improvements for the TypeScript ecosystem.

"TypeScript 6.0 will be the immediate precursor to that release, and in many ways it will act as the bridge between TypeScript 5.9 and 7.0," explained the TypeScript team in their announcement. "As such, most changes in TypeScript 6.0 are meant to help align and prepare for adopting TypeScript 7.0."

Among the notable features introduced in TypeScript 6.0 is improved type inference for functions with implicit 'this' parameters. Previously, TypeScript would treat functions with implicit 'this' parameters as contextually sensitive, potentially causing type inference issues in certain scenarios. The new version recognizes that when 'this' is not actually used in a function, it should not be considered contextually sensitive, leading to more intuitive type inference behavior.

Another significant addition is support for subpath imports starting with #/, aligning with recent updates to Node.js 20. This enhancement allows developers to use simpler import paths like import * as utils from "#/utils.js" instead of more complex relative paths. The feature works with the --moduleResolution settings of node20, nodenext, and bundler.

The release also introduces the --stableTypeOrdering flag, designed to help with the transition to TypeScript 7.0. This flag makes TypeScript 6.0's type ordering behavior match 7.0's, reducing differences between the two codebases. While not intended for long-term use, it can help diagnose potential issues when migrating between versions.

TypeScript 6.0 adds support for the es2025 option for both target and lib, providing types for upcoming JavaScript APIs like RegExp.escape. The release also includes built-in types for the Temporal API, which has reached stage 3 in the ECMAScript proposal process, and new "upsert" methods (getOrInsert and getOrInsertComputed) for Map and WeakMap that reached stage 4 in the ECMAScript proposal process.

The DOM library has been enhanced to include dom.iterable and dom.asynciterable by default, eliminating the need to explicitly include these in the "lib" array for most projects.

However, the release also brings numerous breaking changes and deprecations reflecting the evolving JavaScript ecosystem. Several compiler options now have updated default values: strict is now true by default, module defaults to esnext, target defaults to the current-year ES version (currently es2025), and noUncheckedSideEffectImports is now true by default.

The rootDir option now defaults to the directory containing the tsconfig.json file rather than being inferred, and the types field in tsconfig.json now defaults to an empty array instead of automatically including all packages in node_modules/@types.

Deprecated options include target: es5, --downlevelIteration, --moduleResolution node, various module system values (amd, umd, systemjs, none), --baseUrl, --moduleResolution classic, --esModuleInterop false, --allowSyntheticDefaultImports false, --alwaysStrict false, --outFile, legacy module syntax for namespaces, asserts keyword on imports, and no-default-lib directives.

The team emphasizes that while these deprecated options will continue to work when "ignoreDeprecations": "6.0" is set, they will be removed entirely in TypeScript 7.0. "If you're seeing deprecation warnings after upgrading to TypeScript 6.0, we strongly recommend addressing them before adopting TypeScript 7.0 in your project," the team advised.

Looking ahead, the TypeScript team expects TypeScript 7.0 to follow soon after 6.0, maintaining continuity while providing a faster feedback loop for migration issues. They encourage developers to try both the 6.0 RC and the native previews of 7.0.

"TypeScript 6.0 is feature-complete, and we anticipate very few changes apart from critical bug fixes to the compiler," the team stated. "Over the next few weeks, we'll focus on addressing issues reported on the 6.0 branch, so we encourage you to try the RC and share feedback."

The TypeScript language has become an essential tool in the modern JavaScript development ecosystem, with its adoption continuing to grow across both frontend and backend projects. The transition to a Go-based compiler represents a significant investment in the language's future performance and scalability.

Developers can install the TypeScript 6.0 RC via npm with the command npm install -D typescript@rc. The team also publishes nightly builds on npm and in Visual Studio Code for those who want to test the latest fixes and features.

For more information about TypeScript 6.0, including detailed documentation on all the new features and breaking changes, developers can refer to the official TypeScript blog and GitHub repository.

Comments

Loading comments...