Type Challenges Judge

Reverse

提出詳細

type Reverse<T extends readonly unknown[]> = T extends [infer F, ...infer Tail] ? [...Reverse<Tail>, F] :T;
提出日時2022-06-28 11:59:37
問題Reverse
ユーザーwaki285
ステータス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']>>, ]