Closed
Description
TypeScript Version: 4.1.0-dev.20200818
Search Terms: Base constructors same return type
Code
declare type Constructor<T> = new (...args: any[]) => T;
declare class FooHost {
static foo: string;
}
declare function FooMixin<T extends Constructor<HTMLElement>>(superclass: T): T & Constructor<FooHost> & typeof FooHost
class Foo extends FooMixin(HTMLElement) { }
The reason I do & typeof FooHost
at the end of FooMixin is because I need to be able to access the static property foo
of the FooMixin's host class. This part works. But it creates a new error:
Base constructors must all have the same return type
What is important here to note is that in my project I use allowJs
+ checkJs
so I have to find a way that doesn't include me being forced to do something like:
class Foo extends FooMixin(HTMLElement)<Args> { }
Because I can't, my implementation is in JavaScript (where the FooMixin is applied).
Expected behavior:
No error
Actual behavior:
Base constructors must all have the same return type