Modeling Data With TypeScript: Unions and Narrowing Quiz

Interactive Quiz ⋅ 12 Questions
By Stephen Gruppetta

In this quiz, you’ll test your understanding of Modeling Data With TypeScript: Unions, Narrowing and Impossible States.

By working through this quiz, you’ll revisit type aliases and interfaces, union and literal types, narrowing, structural typing, discriminated unions with exhaustive switches, and handling null and undefined under strict checks.

Most questions ask you to predict what the checker reports and what Node prints once the types are stripped, so keep the two times apart as you answer.

The quiz contains 12 questions and there is no time limit. You’ll get 1 point for each correct answer. At the end of the quiz, you’ll receive a total score. The maximum score is 100%. Good luck!