type ArrayShift<T> = T extends WritableArray ? _IfNotAnyOrNever<T, T extends [Any?, ...(infer U)] ? U : T> : never;Removes the first element from an Writable Array type.
If the Array is a Tuple, the result will be a new Tuple without the first element.
If the Array is not a Tuple, the result will be the original Array type.
| Type Parameter | Description |
|---|---|
|
|
The |
A new Array type with the first element removed.
type Shifted = ArrayShift<[string, number]>; // [number]
type Same = ArrayShift<(string | number)[]>; // (string | number)[]
type Never1 = ArrayShift<readonly [string, number]>; // never
type Never2 = ArrayShift<any>; // never