Skip to content

Extending a class method with prototype assignment confuses the compiler about membership type #22895

@mohsen1

Description

@mohsen1

This is an issue I encountered when working on webpack/webpack#6862

Bug Repository

See the bug repo for complete code
https://github.com/mohsen1/ts-bug-instance-member

Run npm test to run the test

Expected behavior:
No Error
Actual behavior:

index.js:7:19 - error TS2424: Class 'Ex' defines instance member function 'foo', but extended class 'MyClass' defines it as instance member property.

7 MyClass.prototype.foo = function() {
                    ~~~

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptFixedA PR has been merged for this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions