Pop
提出詳細
type Pop<T extends any[]> = T extends [infer First, ...infer Rest] ? Rest['length'] extends 1 ? [First] : [First, ...Pop<Rest>] : never
提出日時 | 2023-08-10 07:54:02 |
---|---|
問題 | Pop |
ユーザー | tekihei2317 |
ステータス | Accepted |
import type { Equal, Expect } from '@type-challenges/utils' type cases = [ Expect<Equal<Pop<[3, 2, 1]>, [3, 2]>>, Expect<Equal<Pop<['a', 'b', 'c', 'd' ]>, ['a', 'b', 'c']>>, ]