TypeScript 5.5 introduced --isolatedDeclarations, a game-changing option for monorepos. If you're dealing with nested dependencies and slow builds, this article is for you.
TL;DR - Measurable Impact
- ✅ Builds: 30+ seconds → milliseconds
- ✅ Average gain: x3, up to x15
- ✅ Native
.d.tsparallelization - ✅ Compatible with Bun, swc, esbuild
- ⚠️ Trade-off: explicit annotations on public exports
🚨 The Sequential Build Problem
In a monorepo with nested dependencies like A → B → C → D, TypeScript must type-check everything in order to generate .d.ts files.
Typical monorepo architecture:
monorepo/ ├── packages/ │ ├── core/ (package A) │ ├── utils/ (package B, depends on A) │ ├── components/ (package C, depends on B) │ └── app/ (package D, depends on C) └── tsconfig.json
Result? Sequential builds that take:
- 30 seconds for an average library
- Several minutes for a complete monorepo
- Impossible to parallelize because each package waits for the previous
.d.ts
✨ The Solution: --isolatedDeclarations
The principle is simple but powerful: each file can be processed independently, in parallel. No need to analyze the entire codebase to generate declarations.
❌ Without --isolatedDeclarations
✅ With --isolatedDeclarations
📊 Real Benchmarks
Measured Gains
🔧 Practical Migration
tsconfig.json Configuration
{
"compilerOptions": {
// Enable the option (TS 5.5+)
"isolatedDeclarations": true,
// Required to generate .d.ts
"declaration": true,
// Optional: for monorepos with project references
"composite": true,
// Recommended
"strict": true
}
}Migration Steps
Enable the option
Add "isolatedDeclarations": true in tsconfig.json
Run the build
npm run build
TypeScript will flag all exports that need annotations.
Use Quick Fixes
VS Code offers automatic Quick Fixes to add missing types. Migration in 5 minutes for most projects.
🎯 Conclusion
TypeScript 5.5 --isolatedDeclarations: Game Changer
- ⚡Builds x3 to x15 faster - immediate workflow gains
- 🚀Native parallelization - unlocks complex monorepos
- 💎Clearer API - better documentation and DX
- 🔧Quick migration - automatic Quick Fixes in 5 minutes
Adopting --isolatedDeclarations isn't just a technical optimization, it's an investment in your team's productivity. Time savings on each build add up quickly: several hours saved per week for a team of 5 developers.
Already using --isolatedDeclarations in production?
Share your experience and benchmarks with the community. Need help optimizing your TypeScript monorepo?
Let's discuss your project