shift
The shift() function removes the first element of an array and returns a shortened copy. For tuples, the type is updated exactly thanks to ShiftTuple.
Interactive example
Syntax
typescript
function shift<
const GenericInput extends readonly unknown[]
>(
input: GenericInput
): GenericInput extends AnyTuple ? ShiftTuple<GenericInput> : GenericInputParameters
input: Array from which to remove the first element.
Return value
A new array without its first element.
