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']>>, ]