Skip to content

The child class should not be able to access the class field defined by the parent class via superΒ #54054

Closed
@Jack-Works

Description

@Jack-Works

Bug Report

The child class should not be able to access the class field defined by the parent class via super

πŸ”Ž Search Terms

class field super parent

πŸ•— Version & Regression Information

Happens on 5.1.0-beta

⏯ Playground Link

Playground link with relevant code

πŸ’» Code

class T {
    field = () => {}
}
class T2 extends T {
    f() {
        super.field()
//      ~~~~~~~~~~~
    }
}

new T2().f()

πŸ™ Actual behavior

No type error

πŸ™‚ Expected behavior

Type error.

super will look for the parent class, but the class field is always defined on the current instance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    DuplicateAn existing issue was already created

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions