Open
Description
TypeScript Version: 3.2.0-dev.201xxxxx
Search Terms: chained generic mixins
Code
type Constructor<T> = new(...args: any[]) => T;
interface XInterface {
value: string;
}
function make<T extends Constructor<any>>(Base: T) {
return class extends Base implements XInterface {
value = "Hello!"
}
}
// Great. Works.
class _X1 extends make(Function) { hello() { this.value; }}
type _T1 = Constructor<HTMLElement>;
// Oops. But changing `make(Base)`, to `make(Base as _T1)` works perfectly,
// which makes no sense.
function make2<T extends _T1>(Base: T) {
return class extends make(Base) { }
}
Expected behavior:
Compile.
Actual behavior:
Type '{ new (...args: any[]): make.(Anonymous class); prototype: make.(Anonymous class); } & T' is not a constructor function type.