Type alias Pop<Arr>

Pop<Arr>: Arr extends [...(infer Rest), unknown]
    ? Rest
    : []

remove the last element of a tuple.

Type Parameters

  • Arr extends unknown[]

Example

type Result1 = Pop<[1, 2, 3]>; // [1, 2]
type Result2 = Pop<[1]>; // []
type Result3 = Pop<[]>; // []