TypeScript Advanced Patterns: Discriminated Unions, Branded Types