TypeScript · Junior · Question 9 of 75

What does the type string | number mean?

Explanation

A union type allows any of its members. Until the type is narrowed, only operations common to all members are available. An intersection is written with & and requires matching all types at once (A & B).

Further reading

Problem with a question

TypeScript · Junior · question 9

Test yourself

Take the TypeScript · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz