import type { Subtract } from '../math/subtract'; import type { UnknownArray } from '../unknown-array'; /** * Removes the last `N` elements from a tuple type. Does not return the removed types. * * @remarks Its worth noting `Pop`, `Push`, `Shift`, and `Unshift` are inspired by JS; however, the types are not 1:1 for design reasons. More information can be found in [README]( * @example * ``` * declare const tuple: ['d', 'a', 'v', 'i', 'd'] * type Tuple = PopN // ['d', 'a', 'v'] * ``` */ export type PopBy = T extends [ ...infer U, any ] ? N extends 0 ? T : PopBy> : T extends readonly [...infer U, any] ? N extends 0 ? T : PopBy> : T;