TypeScript 6.0: The Last JS-Based Release That Paves the Way for a Go-Rewritten 7.0

by JeariCk 7 min read
typescript 6.0

March 23, 2026 — TypeScript 6.0 is officially out. This release is a bit different. According to Microsoft, it’s the last major version built on the current JavaScript codebase. The next one, TypeScript 7.0, will ship with a compiler written in Go, and the performance leap should be massive.

So consider TypeScript 6.0 a bridge between 5.9 and 7.0. This article breaks down what’s new, what might bite you during the upgrade, and what’s already brewing on the 7.0 side.

typescript 6.0
typescript 6.0

summarize

– TypeScript 6.0 = last major release on the JS codebase
– Highlights: Temporal API types, Map.upsert methods, ES2025 target, better inference for this-less functions
– Default config changes: `types` now defaults to `[]`, `rootDir` defaults to `.`
– Deprecation warnings: `target: es5`, `–baseUrl`, legacy `module` syntax for namespaces
– 7.0 Native Preview is already available in VS Code


Why This Release Is Different

The TypeScript team announced the Go-based compiler rewrite last year. The reason is straightforward: as projects grow, compilation and type-checking speed becomes a real pain. Waiting minutes for a type check in a large monorepo isn’t sustainable.

The Go compiler can leverage native code speed and shared-memory multi-threading — theoretically an order-of-magnitude improvement.

But a rewrite of this scale can’t land in one go. TypeScript 6.0 is the transitional release: it implements behavior as close to 7.0 as possible within the JS codebase, letting developers fix their code before the big switch.


New Features Breakdown

1. Less Context-Sensitivity on this-less Functions

This one looks like a minor technical detail, but it affects everyday coding.

Check this out:

```typescript
 declare function callIt(obj: {
 produce: (x: number) => T,
 consume: (y: T) => void,
 }): void;

// Arrow function — works fine

callIt({

  consume: y => y.toFixed(),

  produce: (x: number) => x * 2,

});

// Method syntax — error in 5.x
 callIt({
 consume(y) { return y.toFixed(); }, // ← error: 'y' is of type 'unknown'
 produce(x: number) { return x * 2; },
 });
 ```

The difference? Method syntax carries an implicit `this` parameter, arrow functions don’t. TypeScript flags such methods as “contextually sensitive” during generic inference and skips them, causing inference to fail.

TypeScript 6.0’s fix is straightforward: if `this` is never actually used in the function, it’s not considered contextually sensitive, so it participates directly in type inference. The example above works in 6.0 regardless of property order.

Contributed by Mateusz Burzyński — a small change, but a welcome one.

2. Subpath Imports Starting with `#/`

Node.js subpath imports let you define internal aliases in `package.json`, avoiding long relative paths like `../../../`.

But there was an annoying constraint: subpaths had to start with `#xxx/`, not `#/` directly.

```json
 // Before
 {
 "imports": {
 "#root/*": "./dist/*"
 }
 }

// After
 {
 "imports": {
 "#/*": "./dist/*"
 }
 }
 ```

Node.js 20 added support for `#/` prefixes, and TypeScript 6.0 follows suit. Works under `–moduleResolution nodenext` and `bundler`.

3. `–moduleResolution bundler` Now Works with `–module commonjs`

Previously, `–moduleResolution bundler` was locked to `–module esnext` or `–module preserve`. With the old `–moduleResolution node` (node10) deprecated, teams in the middle of migration needed more flexibility.

TypeScript 6.0 lifts this restriction. Microsoft still recommends migrating toward one of these end states:

– `–module preserve` + `–moduleResolution bundler` (for bundled web apps or Bun)
– `–module nodenext` (for Node.js apps)

4. The `–stableTypeOrdering` Flag

This flag exists purely to ease the 7.0 migration.

Currently, TypeScript assigns type IDs based on encounter order — pretty primitive. This leads to a weird phenomenon: adding an unrelated `const` declaration above a function can change the union type order in the emitted `.d.ts`.

```typescript
 // Input
 export function foo(condition: boolean) {
 return condition ? 100 : 500;
 }

// Output: 100 | 500

// Add const x = 500 above, and the output becomes 500 | 100
 ```

Ordinarily harmless, but TypeScript 7’s parallel type checking randomizes type creation order, leading to non-deterministic output. 7.0 fixes this with content-based deterministic sorting.

The `–stableTypeOrdering` flag makes 6.0’s ordering match 7.0’s during migration. But it can slow down type-checking by up to 25%, so only use it for migration diagnosis.

5. ES2025 target and lib

ES2025 doesn’t introduce new syntax, but it adds several built-in APIs:

– `RegExp.escape`: safely escape special regex characters
– `Promise.try`: moved from esnext to es2025
– Iterator methods and Set methods: moved from esnext to es2025

```typescript
 function matchWholeWord(word: string, text: string) {
 const escapedWord = RegExp.escape(word);
 const regex = new RegExp(`\\b${escapedWord}\\b`, "g");
 return text.match(regex);
 }
 ```

6. Temporal API Type Support

The Temporal proposal finally reached Stage 4, and TypeScript 6.0 includes built-in type definitions. No more suffering through `Date`’s eccentricities.

```typescript
 let yesterday = Temporal.Now.instant().subtract({ hours: 24 });
 let tomorrow = Temporal.Now.instant().add({ hours: 24 });
 ```

Available via `–target esnext` or `”lib”: [“esnext”]`.

7. Map.upsert Methods (getOrInsert / getOrInsertComputed)

Setting a default value on a Map used to take several lines:

```typescript
 // Before
 let strictValue: unknown;
 if (compilerOptions.has("strict")) {
 strictValue = compilerOptions.get("strict");
 } else {
 strictValue = true;
 compilerOptions.set("strict", strictValue);
 }

// After
 let strictValue = compilerOptions.getOrInsert("strict", true);
 ```

For expensive default computations, `getOrInsertComputed` accepts a callback that only runs when the key is absent.

8. DOM Type Updates and dom.iterable Merge

In 6.0, `lib.dom.d.ts` now includes everything from `lib.dom.iterable.d.ts` and `lib.dom.asynciterable.d.ts`. The old requirement of specifying `”lib”: [“dom”, “dom.iterable”]` for `querySelectorAll` iteration is gone — `”lib”: [“dom”]` is sufficient.

DOM types themselves have been updated to reflect the latest web standards, with adjustments to Temporal API types.


Default Value Changes (Watch Out for These)

TypeScript 6.0 tweaks several key defaults. Direct upgrades might trip you up.

`types` defaults to `[]`

The broadest change. Previously, `types` auto-loaded all `@types/*` packages, meaning your code could silently depend on type definitions you never explicitly imported. Now it’s an empty array by default — only the `@types` packages listed in `tsconfig.json` get loaded.

New projects are unaffected. Existing projects may see a flood of “cannot find type” errors.

`rootDir` defaults to `.`

Without an explicit `rootDir`, TypeScript used to infer it from entry files. The auto-inference could behave oddly — especially with mixed `src/` and `tests/` directory structures, messing up output directory layout.

Now it defaults to `.` (the directory containing `tsconfig.json`), which is much more predictable.

Strict mode on by default

`strict: true` is now the default for new projects.


Deprecated Features (Removed in 7.0)

`target: es5`: still works but deprecated, gone in 7.0. Projects still targeting ES5 should plan an upgrade
`–baseUrl`: deprecated; use path mapping or subpath imports instead
`module` keyword as namespace: `module Foo { … }` should become `namespace Foo { … }`
`asserts` on imports: `import … assert { … }` → `import … with { … }`
`–no-default-lib`: deprecated
CLI files with tsconfig.json: `tsc src/index.ts` alongside a `tsconfig.json` now errors


How to Upgrade to 6.0

1. Run `npx typescript@latest` first to see how many errors surface
2. Handle the `types` default change: explicitly list your `@types` packages in `tsconfig.json`
3. Check `rootDir`: if you’re already using it, verify behavior hasn’t changed
4. Address deprecation warnings: switch `es5` target to `es2015` or higher, rename `module` blocks to `namespace`
5. Try `–stableTypeOrdering`: if you plan to move to 7.0 eventually, use this flag to catch issues early


TypeScript 7.0 Preview

Alongside the 6.0 release, 7.0’s Native Preview is already available in VS Code and on npm.

The headline change: the compiler is rewritten in Go (internally called `tsgo`), bringing:

– Native code execution speed (no JIT warm-up)
– Shared-memory multi-threaded type checking
– Deterministic type ordering (no more declaration file output jitter)

Microsoft says 7.0 is “actually extremely close to completion,” so the stable release likely won’t be far behind 6.0.

If you can upgrade to 6.0, the team even suggests trying out the 7.0 Native Preview directly.


Upgrade Recommendations

New projects: go straight to 6.0, consider trying the 7.0 Preview
Small to medium projects: low risk; most default changes have clear migration guides
Large monorepos: test on a small scope first, handle the `types` default change, then roll out gradually
Still on ES5 target: this is the hardest dependency — solving the target upgrade comes first

Bottom line: TypeScript 6.0 isn’t a “you’ll fall behind without it” release. But with 7.0 right around the corner, adapting now is the smart move.

References:

[TypeScript 6.0 Announcement]

[TypeScript 6.0 Release Notes]

[InfoWorld]


📖 Recommended Reading

Take a look at these articles, you may be interested

RSC(React Server Components) Guide — How They Work, Code Examples, and Framework Comparison

Introductory Analysis: Why Next.js 15 Became the Standard for Agentic AI Apps

Web Components + Astro + htmx: The 2026 Lightweight Frontend Trio

React Compiler 1.0 Is Here: Can We Finally Delete useMemo and useCallback?

Leave a Reply

Your email address will not be published. Required fields are marked *