TypeScript Compiler Options
incremental — TypeScript project configuration
Stores compiler state to support subsequent incremental builds. The build info is disposable and version-dependent; deleting it does not remove program outputs. A cache does not guarantee a speedup or runtime validity. Baseline: TypeScript 5.8.3. Default: false unless composite enables it. Example: create the labeled files in an isolated project and run the commands in order. See companion fixtures for comparison cases and expected results. The first run creates JavaScript and cache; after editing the value to 8, the rebuilt JavaScript contains 8.
Formal Syntax & Structure
typescript syntaxtypescript
{ "compilerOptions": { "incremental": true }}Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| incremental | boolean | Compiler option; default: false unless composite enables it. |
Working Example
Example Snippettypescript
// File: tsconfig.json (omit this label){ "compilerOptions": { "target": "ES2022", "module": "CommonJS", "strict": true, "types": [], "incremental": true, "outDir": "dist", "tsBuildInfoFile": "cache/build.tsbuildinfo" }, "files": [ "index.ts" ]}// File: index.ts (omit this label)export const value: number = 7;
// Run these commands in order in an isolated project:// tsc -p . --pretty false// tsc -p . --pretty false// Before next command, replace index.ts with:// export const value: number = 8;// tsc -p . --pretty false