-
Notifications
You must be signed in to change notification settings - Fork 12.5k
New issue
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
Infinities as number literal types #56272
Comments
Also see the original PR and my original PR. My first version had |
Or negated types. |
🔎 Search Terms
infinity number literal
🕗 Version & Regression Information
⏯ Playground Link
https://www.typescriptlang.org/play?ts=5.3.0-dev.20231031#code/C4TwDgpgBACg9gZwJbCQNwgSQHYDMnYohQC8UAjBAJw0DcAUAPSNSsB6A-PaJFAHIQA5gENUGHPkKhSUALSUaVBs1ZRO9IA
💻 Code
🙁 Actual behavior
In TS 5.2 we get
NumberLiteralType
s withInfinity
and-Infinity
values.In the upcoming TS 5.3 we get a number type in the of the
PositiveInfinity
🙂 Expected behavior
I don't know. I created this issue to discuss exactly that.
Should this part of the change be reverted and should
Infinity
be allowed as a literal number value? Or should-Infinity
be aligned withInfinity
and should it be converted~ to anumber
type as well?Additional information about the issue
I didn't see an
Infinity
as a literal type so I made this change while working in this area. @rbuckton commented here:but it turns out that some try to rely on this. We can see it in this issue, cc @Max10240
The text was updated successfully, but these errors were encountered: