Type checking is slow in CI (tsc)
tsc --noEmit takes minutes in CI, dominating pipeline time even when it ultimately passes.
What this error means
The type-check job is consistently one of the slowest steps, scaling with project size and re-checking everything each run.
tsc --extendedDiagnostics
Files: 4821
Lines: 912340
Check time: 142.6s
Total time: 168.9sCommon causes
How to fix it
Enable incremental and skipLibCheck
- Turn on incremental so unchanged files are skipped
- Set skipLibCheck to avoid checking dependency .d.ts files
tsconfig.json
{
"compilerOptions": {
"incremental": true,
"skipLibCheck": true
}
}Split with project references and cache
- Use tsc --build with project references so only changed projects re-check
- Cache .tsbuildinfo and node_modules between runs
shell
npx tsc --build --incrementalHow to prevent it
- Keep incremental + skipLibCheck on, split large codebases with project references, and cache build artifacts. Faster managed runners (Latchkey) with more RAM and dependency caching cut tsc wall-clock time substantially.
Frequently asked questions
What causes "tsc type-checking is slow"?
The type-check job is consistently one of the slowest steps, scaling with project size and re-checking everything each run.
How do I fix tsc type-checking is slow?
Enable incremental and skipLibCheck
Related guides
tsc out of memory (JavaScript heap) - in CIFix "FATAL ERROR: ... JavaScript heap out of memory" while running tsc in CI - raise Node's heap or shrink th…
tsc --noEmit passes locally but fails in CIFix tsc --noEmit passing locally but failing in CI - usually a different TypeScript version, a stale local ca…
TS6059: File is not under rootDir - in CIFix "error TS6059: File 'x' is not under 'rootDir'. 'rootDir' is expected to contain all source files" when t…