#3192Medium

Reverse

Implement the type version of `Array.reverse()`. Learn tuple manipulation in TypeScript in this medium-level challenge on TypeScriptPro.

In this medium-level challenge, you'll implement the type version of Array.reverse().

Challenge Instructions: Reverse

Medium

Implement the type version of Array.reverse

For example:

type a = Reverse<['a', 'b']> // ['b', 'a']
type b = Reverse<['a', 'b', 'c']> // ['c', 'b', 'a']

Change the following code to make the test cases pass (no type check errors).

👋 Lifetime-License is leaving on August 10, 2026

Get it now for $29

One-time payment. Lifetime access to all pro challenges.

Loading...

Video Walkthrough

Detailed Explanation

type Reverse<T extends unknown[]> = T extends [...infer Rest, infer Last]
  ? [Last, ...Reverse<Rest>]
  : T

How it works:

This challenge helps you understand tuple manipulation and how to apply this concept in real-world scenarios.

This challenge is originally from here.

Share this challenge