Reverse
提出詳細
type Reverse<T extends readonly unknown[]> = T extends [infer F, ...infer Tail] ? [...Reverse<Tail>, F] :T;
提出日時 | 2022-06-28 11:59:32 |
---|---|
問題 | 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']>>, ]