Skip to content

'super.prop' in static method should be allowed to access static properties of base class #42215

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

Open
ajafff opened this issue Jan 5, 2021 · 0 comments
Labels
Bug A bug in TypeScript
Milestone

Comments

@ajafff
Copy link
Contributor

ajafff commented Jan 5, 2021

Bug Report

πŸ”Ž Search Terms

super property access static

πŸ•— Version & Regression Information

  • This is the behavior in every version I tried, and I reviewed the FAQ for entries about "super"

⏯ Playground Link

Playground link with relevant code

πŸ’» Code

// @target: ES5
class Base {
    static method() {}
    static prop = 1;
    static get accessor() { return 1 }
}

class Derived extends Base {
    static fn() {
        super.method; // allowed, as expected
        super.accessor; // not allowed, not expected
        super.prop; // not allowed, not expected
    }
}

πŸ™ Actual behavior

super.accessor and super.prop are marked as error. That makes sense in instance methods, but not in static methods, because static properties are not on the prototype.

Related: #42214

πŸ™‚ Expected behavior

No error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript
Projects
None yet
Development

No branches or pull requests

2 participants