Deep Dive into the Angular Compiler
summary
Angular's compiler reveals concrete internals: five phases (program, analysis, resolve, type-check, emit) and that partial evaluation interpreter almost runs TypeScript to evaluate decorator expressions (even RouterModule.forRoot), marking unreachable parts as dynamic. It builds NgModule compilation/export scopes to ID components for tree-shaking, constructs type-check blocks (TS-only code plus template offsets) to report precise template errors, and adds a ngFor static template hook so loop variables get correctly type-checked at build time.
AI-written summary · about
chapters (17)
- 0:00Intro
- 2:19Templates + Code
- 4:01Example
- 6:49Program Creation
- 7:39Analysis
- 10:19A Compilation Model
- 12:38Features of the Compiler
- 13:54Compilation Scope
- 15:18Template Scoping
- 16:34Partial Evaluation
- 18:49Dynamic Expressions
- 22:07Approach
- 23:09Type Check Blocks
- 25:01Template Error Mapping
- 25:45HTML Templates
- 27:48Type Constructors
- 28:23Template Context Type








