Skip to content
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

No error on super. for inferred class properties in JavaScript #55884

Closed
DanielRosenwasser opened this issue Sep 26, 2023 · 0 comments · Fixed by #55892
Closed

No error on super. for inferred class properties in JavaScript #55884

DanielRosenwasser opened this issue Sep 26, 2023 · 0 comments · Fixed by #55892
Labels
Bug A bug in TypeScript checkJs Relates to checking JavaScript using TypeScript Domain: JavaScript The issue relates to JavaScript specifically Effort: Casual Good issue if you're already used to contributing to the codebase. Harder than "good first issue". Help Wanted You can do this
Milestone

Comments

@DanielRosenwasser
Copy link
Member

In #54056 we added checks for class fields; however, we don't issue the same error in JavaScript for properties inferred from assignments.

// @ts-check

class YaddaBase {
    constructor() {
        this.roots = "hi";
    }
}

class DerivedYadda extends YaddaBase {
    get rootTests() {
        return super.roots; // no error?
    }
}

console.log(new DerivedYadda().rootTests); // prints undefined!

Originally posted by @DanielRosenwasser in #55883 (comment)

@DanielRosenwasser DanielRosenwasser added Bug A bug in TypeScript Help Wanted You can do this checkJs Relates to checking JavaScript using TypeScript Domain: JavaScript The issue relates to JavaScript specifically Effort: Casual Good issue if you're already used to contributing to the codebase. Harder than "good first issue". labels Sep 26, 2023
@DanielRosenwasser DanielRosenwasser added this to the Backlog milestone Sep 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript checkJs Relates to checking JavaScript using TypeScript Domain: JavaScript The issue relates to JavaScript specifically Effort: Casual Good issue if you're already used to contributing to the codebase. Harder than "good first issue". Help Wanted You can do this
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant