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
// your answers type mp = ['9', '0', '1', '2', '3', '4', '5', '6', '7', '8']; type ParseInt<S> = S extends `${infer N extends number}` ? N : never; type ReverseStr<S> = S extends `${infer F}${infer R}` ? `${ReverseStr<R>}${F}` : S; // check S not 0 type _MinusOne<S extends string> = S extends `${infer F}${infer R}` ? F extends '0' ? `9${_MinusOne<R>}` : ParseInt<F> extends number ? `${mp[ParseInt<F>]}${R}` : never : never; type _TrimLeftZero<S> = S extends `0${infer R}` ? _TrimLeftZero<R> : S; type TrimLeftZero<S> = S extends `0` ? `0` : _TrimLeftZero<S>; type __MinusOne<S extends number> = ParseInt<TrimLeftZero<ReverseStr<_MinusOne<ReverseStr<`${S}`>>>>>; type MinusOne<S extends number> = S extends 0 ? -1 : __MinusOne<S>;
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: