microsoft/Typescript
6 articles
Prerequisites
- ›Basic familiarity with compiler concepts (lexing, parsing, ASTs, type systems)
- ›Working knowledge of TypeScript as a language user
- ›Understanding of JavaScript closures and module patterns
The TypeScript Compiler at 30,000 Feet: Architecture & Codebase Navigation
A high-level tour of the TypeScript 6.0 compiler repository — directory structure, five-phase pipeline, core data structures, layered architecture, and build tool.
From Source Text to AST: The Scanner, Parser, and Node System
A deep dive into TypeScript's frontend: the stateful Scanner, recursive-descent Parser, SyntaxKind classification system, and the Node type hierarchy.
The Binder: Building Symbol Tables and Control Flow Graphs
How the TypeScript binder creates Symbols from declarations, populates hierarchical symbol tables, and constructs FlowNode graphs for type narrowing.
The Type Checker: 54,000 Lines of Type Theory in Practice
Inside TypeScript's type checker — the demand-driven architecture, Type hierarchy, assignability algorithm, type inference, control-flow narrowing, and the Program orchestrator.
The Emitter Pipeline: Transformations, Code Generation, and Declaration Files
How TypeScript's emitter orchestrates a chain of AST transformers for code lowering, declaration file generation, emit helpers, and source map output.
The Language Service and tsserver: Powering IDE Experiences
How TypeScript's Language Service wraps the compiler for editor features, and how tsserver exposes these capabilities over a JSON protocol for VS Code and other editors.