`Literal` pins a value to specific strings/ints. Combine with the match statement (Python 3.10+) and a `_ : assert_never` clause for exhaustiveness — every variant must be handled or mypy yells at you.
Compile-time guarantee that every variant of a union is handled. When you add a new variant later, every switch missing that case becomes a type error. The runtime version is a safety net.
TypeScript Discriminated Unions with Exhaustive Switch
Discriminated (tagged) unions give you compiler-checked state machines. Pair with `assertNever` to force every new variant to be handled at every switch site — refactors stop being scary.
`sealed` restricts subclassing to the same module. Combined with exhaustive `when`, the compiler enforces handling of every variant — refactor-friendly state machines.