Skip to content

M4 · Type-level programming

Relay’s HTTP layer and config get types computed from other types and from strings: route params from "/hooks/:source/:id", handler maps derived from the event union, deep-readonly config with deep-partial overrides, and branded ids that can’t be mixed up. You write the kind of type-level code libraries are made of, and learn when not to.

# Lesson
1 Conditional types and infer
2 Distributive conditional types
3 Mapped types and key remapping
4 Template literal types: route params from a path
5 Recursive types: JSON, deep readonly, deep partial
6 Re-implementing the built-in utility types
7 Variadic tuple types
8 Branded and phantom types
9 NoInfer and inference control
10 Declaration merging and module augmentation
11 Capstone: a typed router