-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Comparison targets are reversed (regression) #30118
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Labels
Needs Investigation
This issue needs a team member to investigate its status.
Comments
@falsandtru please provide a reduced repro - thanks! |
@falsandtru Is this a repro? interface Foo<T> {
cast(name: ('' extends T ? string : string)): void;
}
interface Foo2<T> {
cast(name: ('' extends T ? string : string)): void;
}
declare const y: Foo<string>;
const x: Foo<''> = y; // error
declare const y2: Foo2<string>;
const x2: Foo<''> = y2; // ok |
@RyanCavanaugh Repro 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>;
} @jack-williams No. The type parameters in your repro are not reversed. |
@falsandtru Yep, sorry. What about this? class Foo<T extends string> {
private static instance: Foo<string>[];
cast(_name: ([T] extends [string] ? string : string)) {
}
foobar() {
Foo.instance.push(this);
}
} |
Looks like good except an illegal |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@RyanCavanaugh @weswigham @ahejlsberg Caused by #27697
TypeScript Version: 3.4.0-dev.20190222
Search Terms:
Code
https://github.com/falsandtru/spica/blob/v0.0.237/src/supervisor.legacy.ts#L49
Expected behavior:
pass
Actual behavior:
Assignability checking must be N to string, not reverse.
Playground Link:
Related Issues:
The text was updated successfully, but these errors were encountered: