Last of Array
提出詳細
type Last<T extends any[]> = T extends [infer _, ...infer Rest extends any[]] ? Rest extends [infer _, ...infer __ extends any[]] ? Last<Rest> : T[0] : never;
| 提出日時 | 2022-10-07 13:53:08 | 
|---|---|
| 問題 | Last of Array | 
| ユーザー | yotarotsukada | 
| ステータス | Wrong Answer | 
import type { Equal, Expect } from '@type-challenges/utils' type cases = [ Expect<Equal<Last<[3, 2, 1]>, 1>>, Expect<Equal<Last<[() => 123, { a: string }]>, { a: string }>>, ]