Using Polymorphic "this" for static members workaround from #5863 no longer works with subclassing in TypeScript 2.4.
TypeScript Version: 2.4.2
Code
class Parent {
static create<T extends Parent>(this: { new (): T }): T {
return new this();
}
}
class Child extends Parent {
static create(): Child {
return super.create<Child>();
}
}
Expected behavior:
Should not have type errors, which was the behavior in 2.3.4.
Actual behavior:
test.ts(7,7): error TS2417: Class static side 'typeof Child' incorrectly extends base class static side 'typeof Parent'.
Types of property 'create' are incompatible.
Type '() => Child' is not assignable to type '<T extends Parent>(this: new () => T) => T'.
Type 'Child' is not assignable to type 'T'.
Using Polymorphic "this" for static members workaround from #5863 no longer works with subclassing in TypeScript 2.4.
TypeScript Version: 2.4.2
Code
Expected behavior:
Should not have type errors, which was the behavior in 2.3.4.
Actual behavior: