The .tsbuildinfo File
What you'll learn: How TypeScript's incremental build cache file tracks compilation state to dramatically speed up subsequent builds.
What Is the .tsbuildinfo File?
When you enable incremental compilation in TypeScript (with "incremental": true or "composite": true), the compiler generates a .tsbuildinfo file. This is a build cache that stores metadata about your project's compilation state—essentially a ledger of what was compiled, when, and how files depend on each other.
Think of it like a construction site foreman's notebook: instead of rechecking every blueprint and material every day, they note what's been built, which foundations depend on which materials, and only review what's changed since yesterday. This makes rebuilds much faster.
What's Inside?
The .tsbuildinfo file contains:
- File timestamps – when each source file was last compiled
- Dependency graph – which files import/depend on which other files
- Compiler options – ensuring settings haven't changed
- Emit signatures – checksums of generated output
When you run tsc again, TypeScript checks this file first. If a source file's timestamp hasn't changed and its dependencies are stable, TypeScript skips recompiling it entirely.
Where It Lives
By default, the file appears alongside your tsconfig.json or in your outDir. You can customize its location with the tsBuildInfoFile compiler option, but that's beyond where we are in your learning journey.
Why It Matters
Without incremental builds, every compilation starts from scratch—TypeScript reads, parses, type-checks, and emits every file. With .tsbuildinfo, only changed files and their dependents are reprocessed, cutting build times from minutes to seconds in large projects.
Key Takeaway: The .tsbuildinfo file is TypeScript's incremental build cache that stores timestamps and dependencies, enabling dramatically faster rebuilds by only recompiling what's changed.