Advanced TypeScript
Q82 / 100

What does the following recursive conditional type compute? "type Flatten<T> = T extends Array<infer Item> ? Flatten<Item> : T"

Correct! Well done.

Incorrect.

The correct answer is B) It recursively unwraps nested array types until it reaches a non-array element type

B

Correct Answer

It recursively unwraps nested array types until it reaches a non-array element type

Explanation

This recursive conditional type repeatedly applies itself to the inferred array element type, effectively flattening nested array types down to the base element type.

Progress
82/100