Skip to content

Indexing/element access on super avoids instance property checks #55899

Open

Description

Discovered in conversation at #55892 (comment)

class C {
    yadda = () => {};
}

class D extends C {
    badda() {
        super["yadda"]();
    }
}

new D().badda()

Currently there is no error for this code; however, if you switched it to a property access, you'd get the error introduced at #54056.

class C {
    yadda = () => {};
}

class D extends C {
    badda() {
        super.yadda(); // ❌ errors, as expected
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

BugA bug in TypeScriptEffort: CasualGood issue if you're already used to contributing to the codebase. Harder than "good first issue".Fix AvailableA PR has been opened for this issueHelp WantedYou can do thisRescheduledThis issue was previously scheduled to an earlier milestone

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions