Type Challenges Judge

Last of Array

提出詳細

type Last<T extends readonly unknown[]> = T extends [...infer Tail, infer L] ? L:never;
提出日時2022-06-27 11:34:55
問題Last of Array
ユーザーwaki285
ステータスAccepted
テストケース
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 }>>, ]