-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
Allow for class static vars to be called static #44813
Conversation
To make sure I understand correctly, this PR allows declaration of static properties named
at the cost of a non-specific error message in case of duplicated static keywords -- the new message kind of assumes that you meant to declare a property named |
Essentially yes - since you can only have one static modifier, and you're allowed to have a static property named static. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not a huge fan of losing the specific static static p
error message, so maybe it's possible to follow up with code that returns it.
Given how complex this fix is, though, it's probably not worth it. It would mainly help people with batch compiles with lots of errors anyway.
} | ||
|
||
class C5 { | ||
static static |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can I see an example with an initialiser, and one with a type?
OK, let's get this in as it's been reviewed and we felt pretty confident with it |
Fixes #43836 - due to the implementation of #41127 which ended up triggering the bug
Now you can have a static variable called static, and code like
static static p: string
doesn't work because that'sstatic static
andp: string
but you need to add a;
to correctly disambiguate./cc @weswigham