Type alias HeadAndTail<Input>
Head
And
Tail
<Input>: Input extends readonly [infer Head
, ...(infer Tail
)] ? readonly [Head, Tail] : Input extends `${infer Head
}${infer Tail
}` ? readonly [Head, Tail] : Input extends EmptyArray | EmptyString ? readonly [undefined, Input] : readonly [Input[number] | undefined, Input]
Type Parameters
-
Input extends ArrayLike<unknown>
Get a couple with the head and tail of an array or string.
Example