Closed
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.