Open
Description
The similar problem #30118 had been fixed, but appeared again.
TypeScript Version: 3.4.0-dev.20190504
Search Terms:
Code
export abstract class Supervisor<N extends string, P = unknown, R = unknown> {
private static instances_: Set<Supervisor<string, unknown, unknown>>;
private static get instances(): typeof Supervisor.instances_ {
return this.hasOwnProperty('instances_')
? this.instances_
: this.instances_ = new Set();
}
constructor() {
void (this.constructor as typeof Supervisor).instances.add(this);
}
public abstract call(name: N | ('' extends N ? undefined : never), param: P, timeout?: number): Promise<R>;
}
Expected behavior:
pass
Actual behavior:
Argument of type 'this' is not assignable to parameter of type 'Supervisor<string, unknown, unknown, unknown>'.
Type 'Supervisor<N, P, R, S>' is not assignable to type 'Supervisor<string, unknown, unknown, unknown>'.
Type 'string' is not assignable to type 'N'.
'string' is assignable to the constraint of type 'N', but 'N' could be instantiated with a different subtype of constraint 'string'.ts(2345)
Playground Link:
Related Issues: