TypeScript 7.1 beta: what's new, what breaks, how to try it

Abstract

A practical guide to TypeScript 7.1 Beta: the new compiler API, ES2026 support, source phase imports, the breaking changes, and how to install it.

TypeScript 7.1 Beta was announced on 20 October 2026. This guide covers what is in it, what can break, and how to try it without touching your main branch. Everything here comes from the official announcement, read on 21 October 2026. For the wider week, see the TypeScript and AI news digest.

How to try it

Install the beta as a dev dependency, ideally on a branch:

npm install -D typescript@beta

The announcement expects a release candidate in about a month, with the final release shortly after. No exact date is given.

What is new

Import attributes in ambient modules

Import attributes such as with { type: "text" } tell a runtime how to interpret a file. Wildcard declarations like *.md could not take them into account. From 7.1 you can declare modules that match a specific attribute, using the form declare module "*" with { type: "css" }, and likewise for text (typed as string) and bytes (typed as Uint8Array). The post’s own example import looks like this:

import readme from "../README.md" with { type: "text" };

Two caveats from the post: these imports are not checked against files on disk, so a missing file shows up at runtime or in your bundler, and the declarations are not built into TypeScript’s libraries. Library authors are advised not to publish them. Declare them in your own project.

Source phase imports

TypeScript 7.1 supports the proposed import source syntax, which is allowed on default imports only and produces an inert AbstractModuleSource object. For WebAssembly that object is a WebAssembly.Module you can pass to WebAssembly.instantiate.

import source SomeModule from "some-module";

The dynamic form is await import.source("./super-fast-thing.wasm"). You need --module set to esnext, nodenext or preserve, plus an esnext lib or target. The post notes that WebAssembly source imports already work in recent Node.js versions.

ES2026 and newer library methods

--target es2026 and --lib es2026 are now stable. The stabilized library additions include Math.sumPrecise(), Iterator.concat(), JSON.rawJSON(), Error.isError(), Array.fromAsync(), the getOrInsert() and getOrInsertComputed() methods on Map and WeakMap, and the Uint8Array base64 and hex methods. --lib esnext adds proposed methods such as Promise.allKeyed, Promise.allSettledKeyed, Iterator.zip, Iterator.zipKeyed, and Iterator.prototype.chunks, join and includes.

A programmatic API

The new API ships as separate entry points:

Entry point Purpose
typescript/sync Synchronous client for compiler options, checker and program
typescript/async Promise-based equivalent
typescript/fs Request-scoped full and layered file systems
typescript/ast AST node types and enums
typescript/ast/is Node type guards
typescript/ast/factory create* and immutable update* functions

It supports batch compilation, point-in-time snapshots and virtual file systems. API objects are Disposable, and the post warns that skipping disposal can leak memory on the Go side, so declare them with using:

import { API } from "typescript/sync";

using api = new API();

The post’s batch example does not read tsconfig.json and does not support --project. It also does not state that the API is stable, and it asks for feedback, so treat it as a preview.

Content mappers

Content mappers let a file extension such as .vue map to a virtual TypeScript representation, with regions that map back to the original file. They are registered in a top-level contentMappers array in tsconfig.json. Because mappers are arbitrary executables, running them from the command line needs tsc --runExternalCode. In VS Code they require workspace trust, and the js/ts.contentMappers.enabled setting turns them off. The post lists implementations for Astro, CSS Modules, Ember, MDX, Svelte and Vue.

Performance, as reported

The post’s --noEmit table, using the default of 4 checker threads, reports these times in seconds:

Project Before After
bluesky 4.48 3.89
mui-docs 22.2 11.9
sentry 19.6 15.1
t3code-server 26.5 19.1
vscode 21.6 17.7

It also reports memory reductions across the same projects, the largest being mui-docs, from 8,093 MiB to 4,079 MiB. These are the team’s numbers on the team’s chosen projects.[1]

What can break

  1. DOM types. Changes to how lib.d.ts DOM types are generated can affect type checking in existing code.
  2. Stricter distributive type parameters. Inside a distributed conditional branch, a type parameter is now treated more precisely. The post’s example is a Show<A, B> type that used B in the false branch of an A extends B conditional, where distribution broke the relationship between the two. Under 7.1 this reports: “‘B’ is only assignable to the non-distributed ‘A’, but ‘A’ has been distributed here.” The suggested fixes are to remove the constraint if it is unnecessary, or to add conditional checks that satisfy it.

Conclusion

Try the beta on a branch, run your normal type check, and look for the two breaking changes first. Compare --noEmit time and memory on your own repository, because the table above describes someone else’s. Wait for the API to be declared stable before building tooling on it, and keep an eye out for the release candidate, expected in about a month.


  1. Benchmarks are the one genre of paper in which the authors always get the best results. Reviewer 2 recommends running your own. ↩︎