-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptFix AvailableA PR has been opened for this issueA PR has been opened for this issue
Milestone
Description
Bug Report
π Search Terms
mixin getter override
π Version & Regression Information
- This is the behavior in every version I tried
β― Playground Link
Playground link with relevant code
π» Code
class A {
constructor(...args: any[]) {}
get myName(): string {
return 'A';
}
}
function Mixin<T extends typeof A>(Super: T) {
return class B extends Super {
get myName(): string {
return 'B';
}
}
}
class C extends Mixin(A) {
get myName(): string {
// Unexpected Error:
// 'myName' is defined as a property in class 'Mixin<typeof A>.B & A', but is overridden here in 'C' as an accessor.
return 'C'
}
}
var c = new C();
console.log(c.myName); // will print 'C' as expected thoughπ Actual behavior
Error in get myName() of class C:
'myName' is defined as a property in class 'Mixin<typeof A>.B & A', but is overridden here in 'C' as an accessor.
It is obviously incorrect because myName is defined as a getter (NOT a property) in either A or B.
π Expected behavior
No error.
DRiFTy17, mashiachy and LukeAbby
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptFix AvailableA PR has been opened for this issueA PR has been opened for this issue