Closed as not planned
Closed as not planned
Description
π Search Terms
abstract getters members methods mixin
π Version & Regression Information
- This is the behavior in every version I tried, and I reviewed the FAQ
β― Playground Link
π» Code
type Constructor = new (...args: any[]) => {};
function MixinA<T extends Constructor>(base: T) {
abstract class Mixin extends base {
abstract testMethod(): string;
}
return Mixin;
}
function MixinB<T extends Constructor>(base: T) {
abstract class Mixin extends base {
abstract testMethod(): string;
}
return Mixin;
}
class Base {}
// No error reported = FAIL
class ImplementationB extends MixinB(MixinA(Base)) {
}
// Error = OK
// Non-abstract class 'ImplementationA' does not implement inherited abstract member testMethod from class 'MixinA<typeof Base>.Mixin & Base'.(2515)
class ImplementationA extends MixinA(Base) {
}
π Actual behavior
There was no error reported for ImplementationB
TypeScript fails to detect unimplemented abstract members when multiple mixins are composed together, even when those mixins declare the same abstract member.
π Expected behavior
An error should be reported since ImplementationB did not implement the abstract method testMethod from MixinA and MixinB.
TypeScript should report an error when a concrete class extends multiple mixins that declare abstract members, and those abstract members are not implemented in the concrete class.
Additional information about the issue
TypeScript fails to detect unimplemented abstract members when multiple mixins are composed together, even when those mixins declare the same abstract member.