01Type safety
Closed unions over runtime checks.
Every state machine, every event payload, every outcome lives in a closed-union TypeScript type. The compiler is the first reviewer — if a switch statement doesn't cover every case, the build fails. This is the cheapest insurance against the most common production bug: an unexpected category we forgot to handle.
- ·
type DraftStatus = "drafted" | "in_review" | "approved" | ... - ·Exhaustive switch +
assertNever()helper at every endpoint - ·No
anyin production code.unknownat boundaries, then narrowed