Enhance comparison types to support bigint comparison#1449
Conversation
Emiyaaaaa
commented
Jun 5, 2026
- fixed Numeric comparison types: support for bigints? #1413
Also the public docs still only talk aboutt |
|
DONE |
|
Umm... |
|
| expectType<GreaterThanOrEqual<PositiveInfinity, bigint>>({} as true); | ||
| expectType<GreaterThanOrEqual<bigint, PositiveInfinity>>({} as false); | ||
| expectType<GreaterThanOrEqual<NegativeInfinity, bigint>>({} as false); | ||
| expectType<GreaterThanOrEqual<bigint, NegativeInfinity>>({} as true); |
There was a problem hiding this comment.
Add tests for PositiveInfinity/NegativeInfinity and number.
| expectType<GreaterThan<PositiveInfinity, bigint>>({} as true); | ||
| expectType<GreaterThan<bigint, PositiveInfinity>>({} as false); | ||
| expectType<GreaterThan<NegativeInfinity, bigint>>({} as false); | ||
| expectType<GreaterThan<bigint, NegativeInfinity>>({} as true); |
There was a problem hiding this comment.
I guess it's fine to return boolean in all these cases. PositiveInfinity and NegativeInfinity are anyway not that common, and returning boolean isn't inaccurate, it's just imprecise.
Also, if we handle these cases, then GreaterThan<PositiveInfinity, number> should also return false, which it currently doesn't (returns boolean currently).
There was a problem hiding this comment.
I think it makes sense to keep the implementation simple, and just return bigint if bigint extends A | B. And remove the IsFinite type.