type Constructor<T> = new (...args: any[]) => T;
function f1<T extends {}>(naked: Constructor<T>): any {
return class dressed extends naked { } // error
}
function f2<T extends Constructor<{}>>(naked: T): any {
return class dressed extends naked { } // ok
}
f1
mentions that
'dressed' can be assigned to the constraint of type 'T', but 'T' may potentially be instantiated with a different subtype of constraint '{}'.</p>
<p>I believe there isn't any logical issue in <code>f1
, so why is there a syntactical problem?