thecodex.expert · The Codex Family of Knowledge
TypeScript

The TypeScript Compiler

The compiler’s type-checking pass and its code-emitting pass are genuinely separate steps — which is why type errors don’t always stop JavaScript from being generated.

TypeScript 6.0 Parse → check → emit Last verified:
Canonical Definition

tsc runs through several distinct stages: parsing source into an abstract syntax tree, binding to build a symbol table, type-checking the AST against that table, and finally emitting plain JavaScript with all type syntax completely erased. These stages are genuinely separable — type-checking and emitting are different passes, which is why tsc can be configured to still emit JavaScript even when type errors are present. Project references let a large codebase be split into multiple tsconfig.json projects, each independently and incrementally compiled, which meaningfully speeds up builds in a monorepo.

Type errors don't necessarily stop JavaScript output

By default, tsc still emits JavaScript even when type errors exist — checking and emitting are separate passes. noEmitOnError changes this, refusing to emit any output at all if type-checking failed.

TypeScripttsconfig.json
{
  "compilerOptions": {
    "noEmitOnError": true   // refuse to emit .js files if there are type errors
  }
}

Incremental compilation

incremental caches information about the previous compilation in a .tsbuildinfo file, so a subsequent build only re-checks what actually changed — a meaningful speedup on large codebases, especially combined with --watch mode during development.

TypeScripttsconfig.json
{
  "compilerOptions": {
    "incremental": true,
    "tsBuildInfoFile": "./.tsbuildinfo"
  }
}

Project references for large codebases

Splitting a large monorepo into multiple smaller projects, each with its own tsconfig.json and a references array pointing at its dependencies, lets tsc rebuild only the projects that actually changed rather than the entire codebase every time — a significant win for build time as a repository grows.

TypeScripttsconfig.json (app)
{
  "compilerOptions": { "composite": true },
  "references": [
    { "path": "../shared-utils" }
  ]
}

As of 2026, this whole pipeline is undergoing its most significant change ever: TypeScript 7.0 (in Release Candidate as of June 2026) ports the entire compiler and language service to Go, reporting roughly a 10x speedup in type-checking on large codebases while preserving identical checking behavior to the previous JavaScript-based compiler.

Sources

1
Microsoft. TypeScript Handbook, "Compiler Options" and "Project References", typescriptlang.org/docs/handbook.