Skip to content
Tutorials Center
My learning

Topics

TypeScript Reference ยท tsconfig: Projects, Files and Watch Options

TypeScript diagnostics and extendedDiagnostics options

Reference for the TypeScript diagnostics and extendedDiagnostics options: print compile-time statistics, read each line, and find slow parts of a build.

diagnostics makes the compiler print a short summary of the work it did after a compile: how many files and lines it read, how much memory it used, and how long each phase took. extendedDiagnostics prints everything in that summary plus finer detail, such as more counters and timings per phase.

These flags do not change compiled output. They answer the question "why is my build slow?" before you reach for deeper tools such as --generateTrace.

TEXT
tsc --noEmit --extendedDiagnostics

Try it

The numbers depend on your machine, so the examples work on a pasted sample of the output and show how to read it.

TypeScript Parsing the statistics block

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with node:readline or readFileSync(0)), it gets the next line from this box.

TypeScript Where did the time go

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with node:readline or readFileSync(0)), it gets the next line from this box.

Syntax

TEXT
tsc --diagnostics
tsc --extendedDiagnostics
JSON
{ "compilerOptions": { "extendedDiagnostics": true } }
Line Meaning
Files, Lines How many files and lines were part of the program, split into library, declaration and your own code.
Identifiers, Symbols, Types Counts of names, declared entities and distinct types the checker created.
Instantiations How many times generic types were instantiated; large values point to heavy type-level code.
Memory used Peak memory estimate.
I/O Read time, Parse time, Bind time, Check time, Emit time Time spent per phase; the extended report adds more entries.

The exact list of lines varies between compiler versions, so do not parse it in scripts that must keep working across upgrades.

Usage notes

  • Check time dominates in most projects. If it is large, look at Instantiations and at generic-heavy files.
  • Files and Lines too big? Use listFiles and explainFiles to find unexpected inputs, such as an accidentally included node_modules folder or the whole DOM library.
  • Compare like with like. Run twice and ignore the first, because cold disk caches distort I/O time; with incremental the second run does less work.
  • --noEmit isolates type-checking cost from emit cost.
  • Deeper profiling. --generateTrace <dir> writes a trace file you can open in a performance viewer.
  • Do not benchmark across versions using these lines alone; counters can be defined differently.