Tag: Tagged Unions
All the articles with the tag "Tagged Unions".
Booleans Lie: Modeling State with Discriminated Unions in TypeScript
Updated:Three booleans give you eight states when you only meant four. Discriminated unions make the illegal ones unrepresentable — model a value as exactly one of a fixed set of shapes and let TypeScript hold you to it.