Closed
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>
.