TypeScript Compiler Options

generateCpuProfile — TypeScript compiler diagnostics

Writes a V8 CPU profile of the compiler process to a specified path. Inspect the profile with a compatible CPU profiler to find expensive compiler call stacks; it does not profile the emitted application. The profile may contain filesystem paths, and its timing is workload-dependent. Official documentation recommends the CLI form; the example supplies the filename explicitly. Baseline: TypeScript 5.8.3. Default: disabled unless requested. Create the labeled files in an isolated directory and run the commands below. A nonempty V8 CPU profile is created; inspect it locally rather than treating sampling durations as deterministic.

Formal Syntax & Structure

typescript syntaxtypescript
tsc --generateCpuProfile profile.cpuprofile

Parameters & Attributes

NameTypeDescription
generateCpuProfilestringCLI profile output path; supply explicitly.

Working Example

Example Snippettypescript
// File: tsconfig.json (omit this label){  "compilerOptions": {    "target": "ES5",    "module": "CommonJS",    "lib": [      "ES5"    ],    "strict": true,    "types": [],    "outDir": "dist",    "noEmitOnError": true,    "noEmit": true  },  "files": [    "index.ts"  ]}// File: index.ts (omit this label)export const count: number = 7;
// Run these commands in order in an isolated project:// tsc -p . --pretty false --generateCpuProfile profile.cpuprofile
TypeScript Reference