-
Notifications
You must be signed in to change notification settings - Fork 143
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
Parse error when constructor argument has negative number default value #522
Comments
Thanks for the report! Looks like it's misinterpreting the |
alangpierce
added a commit
that referenced
this issue
May 10, 2020
Fixes #522 Previously, the logic to compile TS constructor param assignments walked through all tokens in the constructor looking for access modifiers, but this can cause problems if default values include access modifiers. Now, we mark commas associated with the constructor and only emit assignments when we see an open-paren or comma followed by an access modifier.
alangpierce
added a commit
that referenced
this issue
May 10, 2020
#531) Fixes #522 Previously, the logic to compile TS constructor param assignments walked through all tokens in the constructor looking for access modifiers, but this can cause problems if default values include access modifiers. Now, we mark commas associated with the constructor and only emit assignments when we see an open-paren or comma followed by an access modifier.
This is fixed now in Sucrase 3.14.0. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This code will produce an error
Expected identifier after access modifiers in constructor arg.
:see https://sucrase.io/#selectedTransforms=typescript&code=export%20class%20Foo%20%7B%0A%09constructor(%7B%20p%20%3D%20-1%20%7D%3A%20%7B%20p%3A%20number%20%7D)%20%7B%0A%0A%09%7D%0A%7D
The text was updated successfully, but these errors were encountered: