-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Closed
Labels
DuplicateAn existing issue was already createdAn existing issue was already created
Description
TypeScript Version: 2.0.0
Code
class A<T> {
private _: T;
}
class B<T> {
private _: T;
}
function f() {
var o: A<void> | B<void> = new B<void>();
if (!(o instanceof B)) return o; // B<void>, should be A<void>
o; // B<any>, should be B<boid>
}Expected behavior:
A type of o narrowed by type guard inside if statement is A<void>.
A type of o narrowed by type guard after if statement is B<void>.
Actual behavior:
A type of o narrowed by type guard inside if statement is A<void>.
A type of o narrowed by type guard after if statement is B<any>.
Metadata
Metadata
Assignees
Labels
DuplicateAn existing issue was already createdAn existing issue was already created