Open
Description
TypeScript Version: 4.0
Search Terms:
Code
interface A {
type:'A'
}
interface B {
type:'B'
}
function assert(x:any) :asserts x is A|B{
}
function foo(x: any): any {
x; // any
assert(x);
x; // A | B
if (x.type === 'A') {
return x;
}
x; // B
if (x.type === 'B') {
return x;
}
x; // B, but should be never.
// ^?
}
Expected behavior:
the last x should be never.
Actual behavior:
still B.
Related Issues: