TypeScript · Junior · Question 52 of 75

How does (string | number)[] differ from string[] | number[]?

Explanation

Parentheses matter: string | number[] would mean "a string or an array of numbers".

Further reading

Problem with a question

TypeScript · Junior · question 52

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