Skip to content

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

Closed
@DanielRosenwasser

Description

@DanielRosenwasser

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptDomain: JavaScriptThe issue relates to JavaScript specificallyEffort: CasualGood issue if you're already used to contributing to the codebase. Harder than "good first issue".Help WantedYou can do thischeckJsRelates to checking JavaScript using TypeScript

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions