/** @internal */ export type Tail> = T extends | [infer _First, ...infer Rest] | readonly [infer _First, ...infer Rest] ? Rest : Array; /** @internal */ export type Split = string extends Str | "" ? Array : Str extends `${infer Head}${Delimiter}${infer Rest}` ? [Head, ...Split] : [Str]; /** @internal */ // `Array.prototype.slice` is typed as `Array`; computing the tail tuple is the point of this helper. // oxlint-disable-next-line typescript/no-unsafe-type-assertion export const tail = >(elements: T): Tail => elements.slice(1) as Tail; /** @internal */ export const splitLiteral = ( str: Str, delimiter: Delimiter // `String.prototype.split` is typed as `Array`; computing the literal tuple is the point of this helper. // oxlint-disable-next-line typescript/no-unsafe-type-assertion ): Split => str.split(delimiter) as Split;