Discriminated Unions
Use a common property to narrow union types.
Basic Discriminated Union
Result Type Pattern
State Machine Pattern
Action Pattern (Redux-like)
Event Handling Pattern
Exhaustiveness Checking
Exercise: Create Message Union
Create a discriminated union for messages:
Up next · Lesson 30 of 34
Mapped Types
2 min read
29 of 34 lessons done

Ask Byte about this lesson
A private chat about this lesson. Byte has read the whole lesson, answers in seconds, and shows the section each answer comes from. Ask follow-ups in any language.
Questions & Answers
Public questions about this lesson. The AI Tutor answers right away in your language, the FreeAcademy team checks answers, and every learner can read them.

