Typescript Performance: Going Beyond The Surface
summary
Upgrading TypeScript cuts a 35s compile to under 12s; a 14s project drops to 2s after replacing expensive styled-component inference with a simple typed function and named types. Use tsc --generateTrace plus the Chrome tracing view or typescript-analyze-trace to find the exact file and AST node causing slow checks. Large unions (example: 74,387 string literals) and heavy inference cause 112s files; extract or name complex types, add generics to skip inference, and enable incremental builds (tsbuildinfo).
AI-written summary Β· about
chapters (14)
- 0:00Introduction to TypeScript performance
- 2:05Why TypeScript performance matters
- 4:52Keeping TypeScript up to date
- 7:39How TypeScript compiler works
- 11:14Debugging slow builds
- 13:42Generating TypeScript traces
- 18:45Optimizing TypeScript config
- 19:08Simplifying complex types
- 20:37Refactoring for performance
- 22:03Skipping type inference
- 24:34Avoiding verbose types
- 25:37Using incremental builds
- 26:41Reporting performance issues
- 27:01Summary and final tips
related talks
36mNavigating TypeScript Performance for Better Dev Experience
28mThe Secret To Fast TypeScript
23mTypescript Is SO SLOW...Or Is It?
24mTypeScript and how I've learned to love the compiler
28mTypescript - a necessity front-end tool
40mTypeScript: State of the Union
35mTypeScript at Google
39mPorting the TypeScript Compiler to Go for a 10x Speedup V2
