Migrating to TypeScript 7: 4× faster builds
TypeScript 7 is the native port of the TypeScript compiler to Go. Same language, same semantics, but a compiler that no longer runs on Node.js. Microsoft promises build speedups of "up to 10×". We migrated the Legistry backend (about 1,400 TypeScript files) and measured what actually arrived: 4× faster clean builds.
Measuring build performance
Build benchmarks are simple as long as you force a clean build every run and take the median of several runs. The first run is usually slower due to cold caches:
for i in 1 2 3 4 5; do
rm -rf backend/dist
/usr/bin/time -p node_modules/.bin/tsc -p backend
done
Run this once on TypeScript 6, upgrade, run it again:
npm install --ignore-scripts --save-dev --workspace backend typescript@7
Our results, median of several clean builds on an Apple M1 Pro (16 GB RAM):
| Build | TypeScript 6.0.3 | TypeScript 7.0.2 | Speedup |
|---|---|---|---|
Backend tsc (type-check + emit) | 14.3 s | 3.6 s | 4.0× |
Why not 10×? The headline figure comes from huge codebases whose builds are dominated by type-checking. On a medium-sized project, process startup, declaration emit and file I/O make up a bigger share of the total, and those parts don't get 10× faster. 4× is still an impressive improvement.
vue-tsc needs TypeScript 7.1
vue-tsc drives the compiler through TypeScript's JS API, and typescript@7 doesn't ship one. The Vue team is tracking this in vuejs/language-tools#5381: the API that vue-tsc needs is planned for TypeScript 7.1. There is a community bridge in the meantime, but we only use official packages, so the frontend waits.
Until then the monorepo runs both compilers side by side, using nothing but standard npm workspace resolution:
// package.json (root): vue-tsc resolves this one
"devDependencies": { "typescript": "^6.0.3" }
// backend/package.json: nested under backend/node_modules
"devDependencies": { "typescript": "^7.0.2" }
npm run build --workspace backend picks up the workspace-local TypeScript 7, while vue-tsc keeps resolving TypeScript 6 at the root.
Conclusion
The migration took one new package.json line and two small type-level fixes. Once TypeScript 7.1 ships the API and vue-tsc officially supports it, the frontend follows and the root pin disappears. Our frontend build should then shrink just as dramatically.