Advanced TypeScript
Q86 / 100

What does "distributive conditional types" mean for "type ToArray<T> = T extends any ? T[] : never" when T is a union like "string | number"?

Correct! Well done.

Incorrect.

The correct answer is B) The conditional distributes over each union member, producing "string[] | number[]"

B

Correct Answer

The conditional distributes over each union member, producing "string[] | number[]"

Explanation

Conditional types with a naked type parameter distribute over union types, applying the conditional to each constituent separately and unioning the results.

Progress
86/100