Skip to content

Remove restriction of properties overriding prototype methods #6154

Closed
@RyanCavanaugh

Description

@RyanCavanaugh

We currently enforce this rule:

class Base {
  foo() {
  }
}

class Derived extends Base {
  // Error, cannot override method with property
  foo: () => { };
}

This breaks two real scenarios:

  • You can't declare 'foo' as a property and then mix it in later (Mixins use problem with React #6147)
  • You need to implement foo as an arrow function because you have some unbound callers that your base class didn't

The reverse case is important to continue to enforce, but no one can remember why we have this rule.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FixedA PR has been merged for this issueGood First IssueWell scoped, documented and has the green lightHelp WantedYou can do thisSuggestionAn idea for TypeScript

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions