Type Challenges Judge

Last of Array

提出詳細

type Added<T extends any[]> = [T[0], ...T]; type Last<T extends any[]> = Added<T>[T['length']];
提出日時2022-10-11 13:47:08
問題Last of Array
ユーザーyotarotsukada
ステータス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 }>>, ]