compiler pipeline
The ordered stages the TypeScript compiler runs: scan and parse into a syntax tree, bind names, check types, then emit JavaScript.
In more detail
The scanner and parser turn characters into an abstract syntax tree. The binder connects each name to its declaration, the checker applies the type rules, and the emitter writes JavaScript and declaration files. Checking and emitting are independent, which is why type errors do not stop output by default.
Related terms
- lexical scanner — The first compiler phase, which reads source text character by character and groups it into tokens such as keywords, names and symbols.
- parser — A program or compiler phase that reads text and builds a structured form from it, such as a syntax tree or a typed object.
- binder — The compiler phase that links every name in the code to the declaration it refers to and records which scope it lives in.
- static type checking — Checking that values are used consistently with their declared types by analysing code without running it.
- emitter — The last compiler phase, which writes the JavaScript output and optional declaration files from the checked syntax tree.
- AST — A tree of objects that represents the structure of source code, built by the parser and used by every later compiler phase.
Taught in
- Why TypeScript: Contracts, Erased Types And Soundness — Production TypeScript
- The Compiler Pipeline: tsc, AST And Code Emission — Production TypeScript
- Verify Your Environment: Running tsc And Bun TypeScript — Production TypeScript
- The Spine Artifact: Generating Typed Models From OpenAPI — Production TypeScript