# Course — Reading TypeScript's Type Language

A systematic path through the TypeScript type system. Every lesson is grounded in a
concrete worked example — drawn from common real-world patterns, or, for a few advanced
topics, taught directly from the official TS Handbook and cited as such.
Sequenced beginner → advanced.

**Goal:** go from "type-level code feels like magic" to
"I can read and reason about any TypeScript type — including library-grade generic
inference and mapped / conditional / template-literal types."

**Status: all 32 lessons + 7 reference sheets built.** ✅
(Core course 2026-06-23; added 2026-06-25: **0.5 Call/construct signatures** and **1.3 Union, intersection &
variance** (union/intersection and variance merged into one lesson). Files in reading order: `lessons/00NN` = lesson number.)
Open `index.html` for the clickable course map. Legend: ✅ done.

---

## Module 0 — Reading TS syntax  ·  ref: `reference/0001`, `reference/0002`
- ✅ **0.1** Type position vs value position — the `:` / `=>` decoder · `lessons/0001`
- ✅ **0.2** Annotation vs inference vs definition · `lessons/0002`
- ✅ **0.3** `as` vs `satisfies` vs annotation — widen, assert, or check · `lessons/0003`
- ✅ **0.4** Structural typing & excess-property checks · `lessons/0004`
- ✅ **0.5** Call & construct signatures — the object-type form of a function · `lessons/0005`

## Module 1 — Core type vocabulary  ·  ref: `reference/0003`
- ✅ **1.1** `type` vs `interface`; `object` vs `{}` vs `Object` · `lessons/0006`
- ✅ **1.2** Literal types, unions, and why not `enum` · `lessons/0007`
- ✅ **1.3** `keyof`, `typeof`, `keyof typeof`, indexed access `T[K]` · `lessons/0008`
- ✅ **1.4** Utility types: `Partial` `Record` `Pick` `Omit` `Exclude` `Extract` · `lessons/0009`
- ✅ **1.5** Tuples vs arrays · `lessons/0010`
- ✅ **1.6** The `never` type — exhaustiveness + key-dropping · `lessons/0011`
- ✅ **1.7** Union, intersection & variance — wider/narrower sets, covariant returns & contravariant params (Module 1 capstone) · `lessons/0012`
- ⬜ *(room to grow)* `readonly` vs mutable array assignability

## Module 2 — Generics  ·  ref: `reference/0004`
- ✅ **2.1** Declaring generics; type parameter vs type variable · `lessons/0013`
- ✅ **2.2** Constraints (`extends`), literal preservation vs widening, `as const` · `lessons/0014`
- ✅ **2.3** How TypeScript infers `T` · `lessons/0015`
- ✅ **2.4** Multi-source inference & priority (return vs param vs property) · `lessons/0016`
- ✅ **2.5** Rest/tuple params — `...args: TArgs extends any[]` · `lessons/0017`

## Module 3 — Type-level programming  ·  ref: `reference/0005`
- ✅ **3.1** Mapped types + indexed access · `lessons/0018`
- ✅ **3.2** Key remapping with `as`; template-literal keys; `Capitalize` · `lessons/0019`
- ✅ **3.3** Conditional types & `infer` · `lessons/0020`
- ✅ **3.4** Distributive conditional types · `lessons/0021`
- ✅ **3.5** Template-literal types & recursion · `lessons/0022`
- ✅ **3.6** Record → discriminated union · `lessons/0023`

## Module 4 — Library-grade patterns (synthesis)  ·  ref: `reference/0006`
- ✅ **4.1** Reading `useQuery`'s nested generics · `lessons/0024`
- ✅ **4.2** Builder pattern with phantom types · `lessons/0025`
- ✅ **4.3** Branded / nominal types · `lessons/0026`
- ✅ **4.4** React types: `ReactNode` vs `ReactElement` vs `JSX.Element`; `ComponentProps` · `lessons/0027`
- ✅ **4.5** Zustand generic with type transformation · `lessons/0028`
- ✅ **4.6** Capstone — "Types are the new RegEx" · `lessons/0029`

## Module 5 — Tooling & ecosystem  ·  ref: `reference/0007`
- ✅ **5.1** `declare` & `.d.ts` declaration files · `lessons/0030`
- ✅ **5.2** `tsconfig`: `module` vs `moduleResolution`; `package.json` interplay · `lessons/0031`
- ✅ **5.3** Where TS is going — TS 7.0 / Go port · `lessons/0032`

---

### How it was built
- Sequenced beginner→advanced. Goal = **read confidently** (not author).
- Each lesson: one tangible win, a worked example, 3 retrieval quizzes (equal-length
  options), a primary handbook source, and links back here. Shared look via `assets/lesson.css`.
- For several Module 4–5 topics and distributive conditionals, the lesson teaches from the
  official handbook / library docs and says so in its footer.
