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
Digit
Digits
It would be helpful to be able to specify Digits and Digit types.
import * as H from 'hotscript' type Digits<T extends number> = H.Eval<H.Unions.Range< H.Eval<H.N.Power<10, H.Eval<H.N.Sub<T, 1>>>>, H.Eval<H.N.Sub<H.Eval<H.N.Power<10, T>>, 1>> >> | (T extends 1 ? 0 : never); type Digit = Digits<1>;
const some1DigitNumber: Digit = 5; // ✅ const some1DigitNumberString: `${Digit}` = "5"; // ✅ const some2DigitNumber: Digits<2> = 99; // ✅ const some2DigitNumberString: `${Digits<2>}` = "99"; // ✅
TypeScript Playground: https://www.typescriptlang.org/play?#code/JYWwDg9gTgLgBAKjgQwM5wBJwGZQiOAcgAsIZUBjKYMGQg…
UPDATE: I've refined the example to include the recently supported Unions.Range.
Unions.Range
The text was updated successfully, but these errors were encountered:
No branches or pull requests
It would be helpful to be able to specify
Digits
andDigit
types.Definitions
Usages
TypeScript Playground: https://www.typescriptlang.org/play?#code/JYWwDg9gTgLgBAKjgQwM5wBJwGZQiOAcgAsIZUBjKYMGQg…
UPDATE: I've refined the example to include the recently supported
Unions.Range
.The text was updated successfully, but these errors were encountered: