TypeScript · Lesson 39 of 120
Unions Quiz
Test yourself.
Let's review unions and narrowing. Pause after each question, and answer before I do.

- Unions quiz
- Pause and think
- Then check
Question 1
How do you write number or string? With a vertical bar between them.
Quick check
Number or string is:
Question 2
Which check narrows a union of object shapes by a property? The in operator.
Quick check
To check for a property, use:
Question 3
What's the shared literal field in a discriminated union often called? Kind.
Quick check
The shared field is often:
Question 4
What type makes switches exhaustive? Never.
Quick check
Exhaustive checks assign to: