We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
type NumberToTuple<T extends number, U extends 1[] = []> = U['length'] extends T ? U : NumberToTuple<T, [...U, 1]>; type Subtract<A extends number, B extends number> = NumberToTuple<A> extends [ ...NumberToTuple<B>, ...infer R ] ? R['length'] : 0; type ToNonNegativeIndex< Index extends number, Length extends number > = `${Index}` extends `-${infer AbsIndex extends number}` ? Subtract<Length, AbsIndex> : Index; type SliceWithNonNegativeIndices< Arr, Start, End, Index extends 1[] = [], Result extends unknown[] = [] > = End extends Index['length'] ? Result : Arr extends [infer F, ...infer R] ? Start extends Index['length'] | 0 ? SliceWithNonNegativeIndices<R, 0, End, [...Index, 1], [...Result, F]> : SliceWithNonNegativeIndices<R, Start, End, [...Index, 1], Result> : []; type Slice< Arr extends unknown[], Start extends number = 0, End extends number = Arr['length'] > = SliceWithNonNegativeIndices< Arr, ToNonNegativeIndex<Start, Arr['length']>, ToNonNegativeIndex<End, Arr['length']> >;
The text was updated successfully, but these errors were encountered:
No branches or pull requests
The text was updated successfully, but these errors were encountered: