-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Allow this in static initializers #8363
Copy link
Copy link
Open
Labels
Awaiting More FeedbackThis means we'd like to hear from more people who would be helped by this featureThis means we'd like to hear from more people who would be helped by this featureES NextNew featurers for ECMAScript (a.k.a. ESNext)New featurers for ECMAScript (a.k.a. ESNext)SuggestionAn idea for TypeScriptAn idea for TypeScript
Metadata
Metadata
Assignees
Labels
Awaiting More FeedbackThis means we'd like to hear from more people who would be helped by this featureThis means we'd like to hear from more people who would be helped by this featureES NextNew featurers for ECMAScript (a.k.a. ESNext)New featurers for ECMAScript (a.k.a. ESNext)SuggestionAn idea for TypeScriptAn idea for TypeScript
The following is an error:
I can see some potential for confusion here, though I'm not sure what that confusion might be. On the flip side, it seems useful to be able to refer to an anonymous class in a static initializer. It is also easy to teach that "this in instance initializers = the instance, this in static initializers = the class, same as methods vs. static methods."