Super call of non-method disallowed for static field disallowed unnecessarily #45712
Labels
Awaiting More Feedback
This means we'd like to hear from more people who would be helped by this feature
Suggestion
An idea for TypeScript
Bug Report
🔎 Search Terms
Only public and protected methods of the base class are accessible via the 'super' keyword.
static getter, setter, field, property
🕗 Version & Regression Information
Repro'd in stable, nightly, and TS 3.3.3
super
.⏯ Playground Link
Playground link with relevant code
💻 Code
🙁 Actual behavior
When targeting ES5 we get the diagnostic
Only public and protected methods of the base class are accessible via the 'super' keyword.
on thesuper.styles
.This is a good diagnostic for the non-static case, because if
super.styles
was a property rather than an accessor then it probably wouldn't be accessible, asSuperClass.prototype.styles
because it would be initialized in the constructor.However a
static
field can reasonably be expected to have been initialized, and to be accessible atSuperClass.styles
regardless of whether it's a property or an accessor.🙂 Expected behavior
This should be allowed for static getters, as we have the super class object that we can access (unlike the non-static case, where we can't necessarily get at the original field if it wasn't a getter).
The text was updated successfully, but these errors were encountered: