Annotated solution
Published August 18, 2026The solution
type TupleToUnion<T extends readonly unknown[]> = T[number]The common wrong answer
type TupleToUnion<T extends readonly unknown[]> = T extends readonly [infer H, ...infer R] ? H : never
A reasonable instinct — destructure and take the head — but it stops there and returns only the first element. Recursing and unioning the results would work, and it is exactly the long way round: T[number] already does it.
Line by line
T[number]An indexed access whose key is the whole
numbertype. Since every valid numeric index selects one element, asking for all of them at once yields the union of every element type.TupleToUnion<[]>The empty tuple has no valid numeric index, so the union of zero things comes back — and the union of nothing is
never.
Takeaway
Reach for recursion only when indexing cannot express the question. T[number], keyof T and T[keyof T] answer a surprising share of tuple and object problems in a single line.

