The TypeScript team announced the TypeScript 7.1 Release Candidate on 4 December 2026. The team says 7.1 is now feature-complete, with only critical fixes expected before the stable release in about two weeks. So this is the right moment to try it on your codebase.

We covered the 7.1 beta back in November. This post focuses on what you can do with the RC today and what changed since the beta: content mappers, the new --disableDynamicImportExtensionRewriting flag, an experimental WebAssembly build, and a stricter check that might break some type-level code. I installed typescript@rc (version 7.1.1-rc) and compiled the examples myself. The source is the official TypeScript 7.1 RC announcement.

Install the RC

npm install -D typescript@rc
npx tsc -v
# Version 7.1.1-rc

Pin the RC in a branch, run your normal tsc build and test suite, and report regressions now, while they can still be fixed before the stable release.

Typed imports for CSS, text and bytes

Import attributes such as with { type: "json" } tell a runtime or bundler how to load a file. TypeScript 7.1 lets you declare ambient modules keyed on import attributes, so each import gets the right type and a missing attribute becomes an error.

Add a declaration file to your project:

// assets.d.ts
declare module "*" with { type: "text" } {
  const content: string;
  export default content;
}

declare module "*" with { type: "bytes" } {
  const content: Uint8Array;
  export default content;
}

Then use it:

// app.ts
import notes from "./notes.txt" with { type: "text" };
import logo from "./logo.png" with { type: "bytes" };

const length: number = notes.length;          // string
const firstByte: number | undefined = logo[0]; // Uint8Array

When I compiled this with module: nodenext and "type": "module" in package.json, it type-checked cleanly. Without the attribute, import notes from "./notes.txt" failed with Cannot find module ‘./notes.txt’, which is exactly the guard you want.

Two notes from the announcement:

  • TypeScript doesn’t check that these files exist. A failed lookup shows up at runtime or in your bundler.
  • These declarations are not in the built-in libraries. Apps should add them to their own projects. Libraries shouldn’t publish them, to avoid clashing global declarations.

I also hit one gotcha: under a CommonJS module setting, TypeScript reports that import attributes aren’t allowed on statements that compile to require calls. Use an ESM setup.

--target es2026 is stable

es2026 is now a stable --target and --lib value. The lib now includes APIs that have reached ECMAScript 2026, including:

  • Math.sumPrecise()
  • Iterator.concat()
  • JSON.rawJSON(), and a JSON.parse() overload that gives you the original source text
  • Error.isError()
  • Map/WeakMap getOrInsert() and getOrInsertComputed()
  • Uint8Array toBase64(), toHex(), fromBase64(), fromHex() and friends
  • Array.fromAsync()

This compiled cleanly with "target": "es2026", "lib": ["es2026", "dom"]:

const total = Math.sumPrecise([0.1, 0.2, 0.3]);

const counts = new Map<string, number>();
counts.set("a", counts.getOrInsert("a", 0) + 1);

const hex = new Uint8Array([222, 173, 190, 239]).toHex();
const bytes = Uint8Array.fromHex(hex);

console.log(total, counts, bytes, Error.isError(new Error()));

Changing the lib only changes types. Check that your runtime actually supports these methods before you rely on them in production, or keep a polyfill.

--lib esnext also adds proposals such as Promise.allKeyed, Iterator.zip and Iterator.prototype.chunks.

Source phase imports

TypeScript 7.1 supports the proposed import source syntax. It gives you a module before it’s linked or run. For WebAssembly, that means a WebAssembly.Module you can instantiate yourself:

import source WasmModule from "./fast.wasm";
import { WASI } from "node:wasi";

const wasi = new WASI({ version: "preview1" });
const instance = await WebAssembly.instantiate(WasmModule, {
  wasi_snapshot_preview1: wasi.wasiImport,
});
wasi.start(instance);

There’s also a dynamic form, await import.source("./fast.wasm"). You need --module esnext, nodenext or preserve, plus an esnext lib or target. The announcement notes that WebAssembly source imports already work in recent Node.js, but many tools don’t support JavaScript source imports yet.

New since the beta: content mappers

This is the biggest addition. Frameworks like Vue, Svelte, Astro and MDX keep TypeScript inside other file formats. Until now, tools like Volar had to work around TypeScript’s APIs to type-check those files. TypeScript 7.1 adds content mappers: plugins, registered by file extension, that give TypeScript a virtual TypeScript view of a file plus mappings back to the original.

You register them in tsconfig.json:

{
  "compilerOptions": {},
  "contentMappers": [
    {
      "package": "@vue/content-mapper",
      "extensions": [".vue"],
      "options": { "target": 3.5 }
    }
  ]
}

That package name is the announcement’s example, and it isn’t on npm yet. The team says mappers have been prototyped or built for Astro, CSS Modules, Ember, MDX, Svelte and Vue, so watch your framework’s release notes.

Content mappers are arbitrary code, so running them from the command line needs an explicit opt-in:

npx tsc --runExternalCode

In VS Code they need workspace trust and permission, and you can turn them off with the js/ts.contentMappers.enabled setting.

New flag: --disableDynamicImportExtensionRewriting

With --rewriteRelativeImportExtensions, TypeScript emits a small runtime helper that rewrites extensions in non-literal dynamic imports such as import(dir + "/foo.ts"). That helper can’t always work out the right path when content mappers control output extensions. The new --disableDynamicImportExtensionRewriting option turns the helper off. You then become responsible for writing paths that resolve correctly at runtime.

Experimental WebAssembly build

A new package, @typescript/typescript-wasip1-wasm, ships lib/tsc.wasm. You can load it as a library or run it as a WASI command (with wasmtime, wasmer or wazero) to use the tsc CLI or the language server. This is what lets 7.1 run in the TypeScript Playground and, experimentally, in VS Code for the Web.

A new API with separate entry points

Tool authors get a modular API: typescript/sync, typescript/async, typescript/fs, typescript/ast, typescript/ast/is, typescript/ast/factory, and experimental typescript/wasm. If you maintain a linter, codemod or doc generator, start testing against these entry points now.

Behaviour change: distributive type parameters

TypeScript 7.1 is stricter in conditional types that distribute over a union. Inside each distributed branch, a type parameter no longer keeps its relationship with other type parameters constrained to the original. Code like this now errors:

type Show<A extends number, B extends A> = `${B} extends ${A}`;
type Issue<A extends number, B extends A> =
  A extends B ? never : Show<A, B>;
// error: Type 'B' does not satisfy the constraint 'A'.

The fix is to remove the constraint if you don’t need it, or to add another conditional check. There are also lib.d.ts updates, so DOM-heavy projects should run a full type check.

Takeaway

Install typescript@rc today and run your build. Try ambient import-attribute declarations if you import text, CSS or binary assets, and consider --target es2026 if your runtimes support it. Watch for the distributive type-parameter error in advanced generic code. Stable 7.1 is expected in about two weeks.