Closed
Description
TypeScript Version: 2.7.0-dev.201xxxxx
Code
class C { }
function f<T extends C>(v: T | string): void {
if (v instanceof C) {
const x: T = v;
console.log(x);
}
}
Expected behavior:
No compile errors:
Actual behavior:
p.ts(5,11): error TS2322: Type 'string | T' is not assignable to type 'T'.
Type 'string' is not assignable to type 'T'.