Course contentsShow
← TypeScript
Lesson 1726 of 1,79639. TypeScript PerformanceFree lesson

Reading the Diagnostics Output

Understand what the diagnostics table shows: files, lines, identifiers, types, and time per phase.

Reading the Diagnostics Output

You'll learn: How to interpret TypeScript's --extendedDiagnostics output to identify which files, types, and compiler phases consume the most time during compilation.

What the Diagnostics Table Shows

When you run tsc --extendedDiagnostics, TypeScript produces a detailed report at the end of compilation. This output breaks down exactly where your build time is going, giving you visibility into the compiler's internal work.

The diagnostics output includes several key sections:

Files and Lines

The report shows how many files were analyzed and total lines of code processed. This gives you a baseline understanding of your project's scale. A project with 500 files and 50,000 lines will naturally take longer than one with 50 files and 5,000 lines.

Identifiers and Types

You'll see counts for identifiers (variable names, function names, etc.) and types the compiler had to track. A high type count often indicates complex generic instantiation or large union types that require significant compiler resources.

Time Per Phase

The most valuable section breaks down time spent in each compilation phase:

  • I/O operations (reading files from disk)
  • Parsing (converting text into syntax trees)
  • Binding (connecting declarations to their uses)
  • Type checking (the bulk of verification work)
  • Emit (generating JavaScript output)

Why This Matters

Think of diagnostics output like a medical blood panel—it shows you the vital signs of your build. If type checking takes 45 seconds while parsing takes 0.5 seconds, you know the problem isn't file I/O but likely complex type operations.

The "Types" count is particularly revealing. If you see millions of type instantiations, you've likely hit a performance bottleneck from deeply nested generics or recursive types.

Key Takeaway: The --extendedDiagnostics output gives you quantitative evidence about which compiler phases and code patterns are slowing down your builds, allowing you to focus optimization efforts where they'll actually matter.