Reverse
提出詳細
type Reverse<T extends unknown[], O extends unknown[] = []> = T extends [infer L, ...infer R] ? R extends unknown[] ? Reverse<R, [L, ...O]> : [L, ...O] : O
提出日時 | 2023-08-08 08:21:41 |
---|---|
問題 | Reverse |
ユーザー | ookkoouu |
ステータス | 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']>>, ]