scalable/craft/ts types in anger cph / /
6 lessons · ~68 min · typescript 5.7

ts types in anger

six lessons on the parts of typescript's type system that actually earn their keep on a production codebase. each lesson is a single pattern, applied to a real boundary — api responses, ids, route tables, currency, request schemas. interactive: every lesson has a type-challenge quiz and a side-by-side variant explorer so you can see what the compiler actually infers, not just what we claim.

what you'll come out with

how the lessons work

lessons

  1. 01 discriminated unions model state the compiler can verify. exhaustive switches, assertNever, and api response shapes that can't lie. 10m
  2. 02 branded types make primitives unforgeable at compile time, with zero runtime cost. UserId is not OrderId — and TS will believe you. 10m
  3. 03 template literal types strings the compiler understands. route patterns, event names, css-in-ts, and parsing — all without a single regex. 12m
  4. 04 conditional types & infer type-level branching. Awaited and ReturnType from scratch. when to reach for it and when not to. 14m
  5. 05 mapped types & key remapping Partial, Pick, Required — built from primitives. key remapping with `as`. the workhorse of the type system. 12m
  6. 06 type predicates at the boundary user-defined guards and assertion functions. where they fit (the boundary). where they're a smell (everywhere else). 10m
scalable labs·cvr 30091604·github·linkedin·hello@scalable.dk