Practical Mastery
Where knowledge becomes judgment
Section titled “Where knowledge becomes judgment”You now know how the type system works. This module is about using it well — the judgment calls that separate someone who can pass the compiler from someone who ships maintainable TypeScript.
The through-line is one uncomfortable truth: the compiler only knows what you tell it. Types are a model of your program, and a model can be wrong. An any, a bad cast, or a JSON blob from the network can all lie to the checker. Mastery is knowing where the model meets reality and defending that boundary.
What this module covers
Section titled “What this module covers”| Lesson | What you’ll learn |
|---|---|
| Typing APIs & boundaries | unknown vs any, validating external data, branded types |
| Nullability & never | strictNullChecks, Result types, exhaustiveness with never |
| Performance & pitfalls | Why tsc gets slow, common footguns, when to simplify |
| Migration strategy | Moving a JS codebase to TS without a big-bang rewrite |
The one idea tying it together
Section titled “The one idea tying it together”flowchart LR world["untyped world network, JSON, any, casts"] -->|validate at the edge| edge["boundary (guards, schemas)"] edge -->|trusted types| inside["your typed code (safe to trust)"]
Everything here is a variation on validate at the edge, trust inside. Push the uncertainty to the boundary of your program, turn it into real types there, and let the whole interior enjoy the guarantees. Get the boundary right and the type system pays you back everywhere else.