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 TupLen<T extends number, U extends number[] = []> = T extends 0 ? [] : U['length'] extends T ? U : TupLen<T, [T, ...U]>; type Abs<T extends number> = T extends 0 ? T : `${T}` extends `-${infer U extends number}` ? U : T; type NRange<T extends number, U extends any[] = []> = U['length'] extends T ? U : NRange<T, [...U, 0]> type Flatten<T, U extends any[] = []> = T extends [] ? U : T extends [infer F, ...infer R] ? Flatten<R, [...U, ...Flatten<F>]> : [...U, T] type TupleSum<T extends number[]> = Flatten<{ [K in keyof T]: NRange<T[K]> }>['length'] type Square<T extends number> = Abs<T> extends 100 ? 10000 : TupleSum<TupLen<Abs<T>>>;
My implementation only works with numbers between -100 and 100
The text was updated successfully, but these errors were encountered:
No branches or pull requests
My implementation only works with numbers between -100 and 100
The text was updated successfully, but these errors were encountered: