QuizNot attempted
Distributive conditional types
1–4 to choose, Enter to submit
Show answer & explanation
Correct answer:
string[] | number[]
- A conditional type on a naked type parameter distributes over a union:
ToArray<string | number>becomesToArray<string> | ToArray<number>=string[] | number[]. - Not (string | number)[]: that is what you get when you stop distribution with
[T] extends [any]. - Not never: both members satisfy
extends any. - Not any[]:
Tkeeps its real type.