TypeScript 7 ·
TypeScript 7 is out, and Angular's ngp is next
Angular ngp compiler explained: TypeScript 7 builds about 10x faster, but Angular templates still need TypeScript 6. What runs on TS 7 today.
TypeScript 7 is released, and it is the Go port. In Microsoft's benchmark the VS Code codebase builds in 10.6 seconds with TypeScript 7, against 125.7 seconds with TypeScript 6. Sentry drops from 139.8 to 15.7 seconds. The team puts typical full-build speedups between 8x and 12x.
Angular projects can't fully use it yet. TypeScript 7.0 ships without a programmatic API, and Angular's compiler is built on TypeScript's JavaScript API, including the ts.Transformer API that can't be called across languages. The TypeScript team says it plainly: template type-checking in tools like Angular will likely not use TypeScript 7 for now.
What an Angular team can use today
Microsoft's suggestion for Angular projects is a split. Use TypeScript 7 for fast project-wide errors with tsc on the command line, and TypeScript 6.0 for editor support. The Angular compiler stays on 6.0 anyway: @angular/compiler-cli 22.2.3 declares a peer dependency of typescript >=6.0 <6.1.
For tools that still import typescript, Microsoft published @typescript/typescript6, which re-exports the 6.0 API. Aliased like this, npx tsc runs 7.0 while typescript keeps resolving to 6.0:
{
"devDependencies": {
"@typescript/native": "npm:typescript@^7.0.2",
"typescript": "npm:@typescript/typescript6@^6.0.2"
}
}That tsc checks your TypeScript files, not your templates. This alias setup comes from the TypeScript post, not from Angular's docs, so I'd try it on a branch first. Check the tsconfig too: baseUrl and moduleResolution: node are hard errors in TypeScript 7.
What ngp changes
The Angular team is building a new compiler, called the Angular Preprocessor (ngp) during development. Its frontend, the analyzer, is written in Rust on top of oxc and reads your source files in parallel. The backend stays in TypeScript and runs Angular's existing template compiler.
For a file like dashboard.ts, ngp generates dashboard.ng.ts with the decorators compiled and dashboard.ngtypecheck.ts with the template expressions translated, so TypeScript can type-check templates as ordinary code. Both come with source maps and usually live only in memory. For type-checking and diagnostics, Angular plans to use the TypeScript 7.1 interop APIs.
What to watch
ngp is nearing its MVP and is being tested against Google's Angular codebase. CLI and language service integrations exist as prototypes, and the team is aiming to ship an experimental version later this year. On speed, their FAQ says it's too early to say. They also expect a few rare template type-checking differences, which they will document as breaking changes.
Until that experimental build lands, I'd use TypeScript 7 for plain tsc checks and keep everything Angular on 6.0.
Sources
- Announcing TypeScript 7.0 (TypeScript blog)
- An update on Angular's TypeScript 7-powered Compiler (Angular blog)
- @angular/compiler-cli package.json, v22.2.3
I post short notes like this on LinkedIn.
Need help with this?
