TypeScript · Senior · Question 20 of 75
How do you find the cause of slow type checking in a large project?
- ✓Correct answer:
tsc --extendedDiagnosticsand--generateTrace - 2Remove files from the project one by one until it gets faster
- 3Turn off
strict- checks will become fast
Explanation
Diagnostics show the time of each phase and the number of instantiations, and a trace (analyzed with @typescript/analyze-trace or in the browser) shows which types are the most expensive. Common culprits: huge unions, deep recursion, complex intersections, missing return type annotations on exports.