Annotated solution
Published July 31, 2026The solution
type Reverse<T extends readonly unknown[]> = T extends readonly [infer H, ...infer R] ? [...Reverse<R>, H] : []
The common wrong answer
type Reverse<T extends readonly unknown[]> = T extends readonly [infer H, ...infer R] ? [H, ...Reverse<R>] : []
This recurses correctly and rebuilds the tuple in the order it took it apart, so it is an elaborate identity function. Reversal is entirely a question of which side of the spread the head goes on.
Line by line
[infer H, ...infer R]The classic head/tail split. `H` binds the first element, `R` binds a tuple of everything after it.
[...Reverse<R>, H]The head is appended *after* the reversed tail. The first element of the input therefore ends up last, and every level of the recursion pushes its head one place further back.
Takeaway
Head-and-tail recursion rebuilds a tuple one element at a time; the order you reassemble in is the only thing that distinguishes a copy from a reversal, a filter or a map.