Explain it in 60 seconds
Discriminated unions
Frontend Engineering · TypeScript · Intermediate
What are discriminated unions, and why are they useful?
What a strong answer covers
Your AI report card counts how many of these ideas you cover.
- Union members share a literal "tag" property.
- Narrow by checking the tag.
- Model states/variants safely.
- Exhaustive switch with never.
- Prevent impossible states.
Practise this topic
Start without signing up. Sign in free to get an AI report card on your answer.