-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Numeric separated literals should disallow zero leading #39563
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
Comments
Browsers have different behavior in case of Currently TS parses it as 2 tokens: Question is: Should fix for this issue should handle only cases UPD. Strange that TS doesn't report |
@RyanCavanaugh I'd like to take on this issue. According to spec test it should be an syntax error so I'll update
Will create separate issue to report errors in this case. Do you have any objections? P.S. I hope @a-tarasyuk doesn't work on this one 😄 |
@IllusionMH I think that sounds reasonable, I don't expect it to be a large breaking change but we can run the test suite |
Not sure that I understood the point to mention me in this issue 😕 . As I know, if the issue marked with the Backlog/Help Wanted/GFI label anyone can try to resolve it, maybe I'm wrong and @DanielRosenwasser 👈 can better clarify the current process. I do PRs from time to time (I can't even say that I did a lot of PRs 😟), however, I definitely cannot work on all issues 😂, unfortunately 😞 . |
UPD. Somehow I managed to write this one ambiguous too 🤦♂️. Clarifications in cursive. @a-tarasyuk It was some kind of positive joke and my real hope that I will have chance to submit PR this time because IMHO you fix a lot of issues and do it quickly (which is great, previously beat me by 2 minutes in other issue with a bit better solution 👍 and I learned new thing). I'm sorry if that mention was inappropriate and for ping. As for this issue - I have fix for numbers starting with |
Yeah, I understood it as a joke in a positive light - as in "@a-tarasyuk fixes a lot of issues really fast, I hope I can fix this one first!" For what it's worth, we all really appreciate working with both of you on this issue tracker, so thank you both! Please don't feel bad about either of your contributions. |
FWIW I have another data point for this: Someone recently reported this as a bug in esbuild's TypeScript-to-JavaScript transformer: evanw/esbuild#2833. The confusion is understandable because TypeScript still incorrectly considers this to be valid syntax. However, I'm planning to keep it a syntax error in esbuild because it's supposed to be an error in JavaScript. But it would be helpful if TypeScript also considered this to be a syntax error so that it would appear as an error when people write code like this in their IDE. Edit: There are also additional bugs where TypeScript has a more permissive numeric parser than JavaScript. One such example is |
Search Terms:
numeric separator
spec test for checking leading zero separated literal
Code
These literals should be invalid:
but this should valid:
Expected behavior:
SyntaxError: Numeric separator can not be used after leading 0.
Actual behavior:
playground
The text was updated successfully, but these errors were encountered: