Type Challenges Judge

Reverse

提出詳細

type Reverse<T extends readonly unknown[]> = T extends [infer T1, ...infer T2] ? [...Reverse<[...T2]>, T1] : []
提出日時2023-09-15 14:13:03
問題Reverse
ユーザーsankantsu
ステータスAccepted
テストケース
import type { Equal, Expect } from '@type-challenges/utils' type cases = [ Expect<Equal<Reverse<[]>, []>>, Expect<Equal<Reverse<['a', 'b']>, ['b', 'a']>>, Expect<Equal<Reverse<['a', 'b', 'c']>, ['c', 'b', 'a']>>, ]