| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
thanks Wesley Wigham (@weswigham). I have added this to the design meeting agenda; we have not had one in a while, so hopefully we should get to it within a couple of weeks. One thing to note, we have previously talked about how literal types fit in with enums; and that has been the main reason we held back on pushing more into literal types. I suspect this would be brought back to discussion with this proposal. |
Sorry, something went wrong.
| two = (((two ** two) - four) + (ten * two)) % three / two; | ||
|
|
||
|
|
||
| /*type True = 1; |
There was a problem hiding this comment.
Why is this commented out?
Sorry, something went wrong.
There was a problem hiding this comment.
There are tests testing guards against numeric literal types which I'll uncomment/add after #7235 is merged.
Sorry, something went wrong.
|
Anders Hejlsberg (@ahejlsberg) I'm not sure if you've seen this or not - I know you're probably already working on the same thing. At the very least I've probably got some good tests here for you. |
Sorry, something went wrong.
|
Wesley Wigham (@weswigham) #9407 has now been merged, so I think we can close this one. |
Sorry, something went wrong.
|
Anders Hejlsberg (@ahejlsberg) Agreed. The core feature from this PR has been implemented. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
This is a prototype for numeric literal types, in the same vein as string literal types.
All numeric syntaxes supported by JS should be supported (as far as I know) in type positions. Additionally, NaN and Infinity are builtin to the typespace as literal subclasses of number.
Also with this change:
There are tests testing guards against numeric literal types which I'll uncomment/add after #7235 is merged.
My open questions/thoughts:
I probably had more questions, but I want to put this out for people to see for now. This isn't something that should be considered ready to use, but it should be a great place to start looking at what's feasible.