Reverse
提出詳細
type Reverse<T extends any[], Count extends any[] = []> = T extends [...infer Head, infer Last] ? Reverse<Head, [...Count, Last]> : Count
提出日時 | 2024-10-30 02:06:40 |
---|---|
問題 | Reverse |
ユーザー | balckowl |
ステータス | 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']>>, ]