TypeScript 6.0: New Defaults, Features, and Migration Guide

AI Bot
By AI Bot ·

Loading the Text to Speech Audio Player...
TypeScript 6.0 release banner showing new defaults and features for developers

TypeScript 6.0 landed on March 23, 2026, and it is not a quiet release. This version rewrites the defaults that most projects have relied on for years, introduces long-awaited language features, and deprecates options that will disappear entirely in the next major version. Most importantly, TypeScript 6.0 is the last release built on the JavaScript-based compiler. TypeScript 7.0 will be a ground-up rewrite in Go, promising dramatically faster build times.

Whether you maintain a small side project or a monorepo with hundreds of packages, this release requires your attention. Here is everything you need to know.

New Defaults That Change Everything

The biggest impact of TypeScript 6.0 comes not from new syntax but from changed defaults. Projects that relied on implicit compiler behavior will see immediate differences.

Strict Mode Is Now On by Default

Every new tsconfig.json created without an explicit strict setting now behaves as if strict: true is enabled. This means strictNullChecks, noImplicitAny, strictFunctionTypes, and every other strict family flag are active unless you opt out.

For teams that already use strict mode, nothing changes. For the many projects that never set strict explicitly and relied on the old permissive default, the compiler will surface new errors after upgrading.

Module Defaults to ESNext

The module compiler option now defaults to "esnext" instead of "commonjs". This reflects the reality that ESM is the standard module format for modern JavaScript. Projects targeting Node.js with CommonJS output should now explicitly set their module format:

{
  "compilerOptions": {
    "module": "commonjs"
  }
}

Target Defaults to ES2025

The target option defaults to "es2025", producing output that leverages the latest stable ECMAScript features. The previous default of "es3" had been outdated for years. If you need to support older runtimes, set target explicitly.

Types Defaults to an Empty Array

Previously, TypeScript would automatically include ambient type packages like @types/node if they were installed. Now, types defaults to [], meaning no ambient types are included unless you list them. This prevents phantom type pollution and makes dependency boundaries explicit:

{
  "compilerOptions": {
    "types": ["node", "jest"]
  }
}

rootDir Defaults to "."

The rootDir option now defaults to "." (the project root) instead of being inferred from the set of input files. This produces more predictable output directory structures, especially in monorepo setups where the inferred root could shift depending on which files were included in compilation.

New Language Features

TypeScript 6.0 brings several features that improve the developer experience and align TypeScript with the latest ECMAScript standards.

Improved Inference for Standalone Functions

Functions defined without a this context now benefit from less context-sensitive type inference. In previous versions, certain callback patterns required explicit type annotations because the compiler could not narrow the types effectively. TypeScript 6.0 handles these patterns automatically, reducing boilerplate in functional codebases.

Subpath Imports with the Hash Prefix

TypeScript now fully supports Node.js subpath imports using the #/ prefix. You can define import aliases in your package.json and have the compiler resolve them correctly:

{
  "imports": {
    "#/utils/*": "./src/utils/*",
    "#/components/*": "./src/components/*"
  }
}
import { formatDate } from "#/utils/date";
import { Button } from "#/components/button";

This eliminates the need for paths in tsconfig.json for many common aliasing patterns and aligns with the Node.js module resolution standard.

The stableTypeOrdering Flag

A new --stableTypeOrdering flag ensures that type declarations are emitted in a deterministic order. Without this flag, certain union types and intersection types could appear in different orders across builds, causing unnecessary diffs in generated declaration files. This flag is especially important for library authors who publish .d.ts files and want reproducible builds.

{
  "compilerOptions": {
    "stableTypeOrdering": true
  }
}

This flag also serves as preparation for TypeScript 7.0, where the Go-based compiler may produce slightly different ordering by default.

ES2025 Target and Library Support

With "target": "es2025" and the corresponding "lib": ["es2025"], TypeScript 6.0 includes type definitions for all stage-4 ECMAScript 2025 features. This includes:

  • Temporal API types: Full type definitions for Temporal.PlainDate, Temporal.ZonedDateTime, Temporal.Duration, and the rest of the Temporal namespace. The Temporal API replaces the long-troubled Date object with an immutable, timezone-aware date/time library built into the language.
const meeting = Temporal.PlainDate.from("2026-03-25");
const nextWeek = meeting.add({ days: 7 });
// nextWeek is Temporal.PlainDate — fully typed
  • Map and WeakMap upsert methods: The new getOrInsert and getOrInsertComputed methods simplify the common pattern of checking whether a key exists before inserting:
const cache = new Map<string, number[]>();
 
// Before: manual check-and-insert
if (!cache.has("scores")) {
  cache.set("scores", []);
}
cache.get("scores")!.push(42);
 
// After: single call with getOrInsert
cache.getOrInsert("scores", []).push(42);
 
// Computed variant for expensive defaults
cache.getOrInsertComputed("stats", (key) => loadFromDisk(key));
  • RegExp.escape: A static method that safely escapes special characters in strings before using them in regular expressions:
const userInput = "price is $9.99 (USD)";
const pattern = new RegExp(RegExp.escape(userInput));

DOM Library Consolidation

The DOM type definitions have been restructured to reduce redundancy and improve accuracy. Several outdated Web API interfaces have been removed, and types for newer APIs like the View Transitions API and the Popover API have been refined. If your project extends DOM types, review the updated lib.dom.d.ts for any naming changes.

Breaking Changes and Deprecations

TypeScript 6.0 deprecates several options that the team considers obsolete. Deprecated options still work in 6.0 but emit warnings and will be removed in 7.0.

Target ES5 Is Deprecated

Generating ES5 output is now deprecated. The overwhelming majority of JavaScript runtimes in use today support ES2020 or later. Projects still targeting ES5 should evaluate whether their audience truly requires it, or whether a dedicated transpiler like Babel is more appropriate for legacy output.

moduleResolution "node" Is Deprecated

The "node" module resolution strategy, which mimicked the Node.js CommonJS resolution algorithm, is deprecated in favor of "node16", "nodenext", or "bundler". The deprecated strategy did not correctly handle the exports field in package.json and could not resolve ESM-only packages.

{
  "compilerOptions": {
    "moduleResolution": "bundler"
  }
}

AMD, UMD, and SystemJS Module Formats Dropped

The module options "amd", "umd", and "system" are no longer supported. These module formats have been effectively replaced by ESM bundlers. Projects still using these formats should migrate to ESM or use a bundler that handles format conversion.

baseUrl Is Deprecated

The baseUrl compiler option, historically used for path aliasing, is deprecated. The recommended alternatives are the paths option with explicit mappings or the new subpath imports feature with #/ prefixes.

Import Assertions Replaced by Import Attributes

The assert keyword in dynamic imports has been replaced by the with keyword, following the TC39 rename from "import assertions" to "import attributes":

// Deprecated (6.0 warning, removed in 7.0)
import data from "./config.json" assert { type: "json" };
 
// Correct
import data from "./config.json" with { type: "json" };

outFile Is Deprecated

The outFile option, which concatenated output into a single file, is deprecated. Modern bundlers handle file concatenation far more effectively, and outFile was incompatible with many module formats.

Migration Guide

Here is a practical checklist for upgrading your project to TypeScript 6.0.

Step 1: Update your types field. Since types now defaults to an empty array, add all required ambient type packages explicitly:

{
  "compilerOptions": {
    "types": ["node", "jest", "webpack-env"]
  }
}

Step 2: Set rootDir explicitly if needed. If your project relied on the inferred rootDir, set it explicitly to preserve your output directory structure:

{
  "compilerOptions": {
    "rootDir": "./src"
  }
}

Step 3: Replace deprecated options. Update your tsconfig.json to replace deprecated settings:

  • Change "moduleResolution": "node" to "moduleResolution": "bundler" or "nodenext"
  • Remove "baseUrl" and use paths or subpath imports instead
  • Replace assert with with in import attributes
  • Remove "outFile" and use a bundler

Step 4: Use ignoreDeprecations as a temporary bridge. If you cannot address all deprecations immediately, TypeScript 6.0 provides a safety valve:

{
  "compilerOptions": {
    "ignoreDeprecations": "6.0"
  }
}

This suppresses deprecation warnings for one release cycle, giving you time to migrate before TypeScript 7.0 removes these options entirely. Do not leave this in place permanently — it will not be valid in 7.0.

Step 5: Run the compiler and fix strict errors. If your project was not already using strict mode, expect a wave of new errors. Address them incrementally by enabling individual strict flags one at a time if the full suite is too much to tackle at once.

The Road to TypeScript 7.0

TypeScript 6.0 is explicitly designed as a bridge release. The TypeScript team has been working on a complete rewrite of the compiler in Go, targeting a 10x improvement in compilation speed. Early benchmarks on the TypeScript codebase itself show full type-checking completing in under 1 second compared to roughly 10 seconds with the current JavaScript-based compiler.

The Go-native TypeScript 7.0 aims to maintain full compatibility with TypeScript 6.0 semantics, but the internal architecture is entirely new. The --stableTypeOrdering flag introduced in 6.0 is one concrete step toward ensuring that the transition produces identical outputs. Library authors should enable it now to identify any code that depends on non-deterministic type ordering.

The deprecations in 6.0 also clear the path for 7.0. By removing legacy module formats, outdated resolution strategies, and rarely used concatenation features, the Go rewrite can focus on the modern TypeScript surface area without carrying years of backward compatibility baggage.

Conclusion

TypeScript 6.0 is a release that respects the direction the ecosystem has already taken. Strict mode should have been the default years ago. ESM is the standard module format. ES5 output is a niche concern. The new defaults align the compiler with how most teams already configure their projects.

The practical impact depends on your codebase. Well-configured projects with explicit tsconfig.json settings may upgrade with zero changes. Projects that relied on implicit defaults will need to make their configuration explicit — which is ultimately a healthier state to be in.

The real story, though, is what comes next. TypeScript 7.0 and its Go-native compiler represent the most significant architectural change in the language's history. TypeScript 6.0 is your opportunity to prepare. Enable stableTypeOrdering, eliminate deprecated options, and make sure your configuration is explicit. When the Go compiler arrives, you will be ready.


Want to read more blog posts? Check out our latest blog post on Agentic Coding: When AI Writes Code Autonomously.

Discuss Your Project with Us

We're here to help with your web development needs. Schedule a call to discuss your project and how we can assist you.

Let's find the best solutions for your needs.