Notes on TypeScript, written between 2020 and 2022 and revised since. Treat them as working notes rather than a reference: they cover the parts I wanted to pin down, in the order I met them, and the TypeScript Handbook is the authority when you need one.
What they do give you that a handbook page does not: every sample in here is compiled, so if a block says it produces an error, it produces that error.
npm install
npm run check-samplesThat extracts every fenced ts block and type-checks it against TypeScript 5.9 under strict.
Blocks that are meant to fail, either because they demonstrate a compiler error or because they
continue an earlier sample, are listed with a reason in samples.allowlist.txt.
-
Intro: what TypeScript is, what it erases, static vs dynamic, and project setup
-
Structural Typing: shape-based compatibility, and the excess property check on fresh object literals
-
Type Inference and Type Annotation
-
Types
-
Type Alias and Interfaces
-
Classes
-
Functions
-
Type Assertions, Type Casting and Type Declaration
-
Type Guards
-
Intersection Types
-
Generics