interfaceA{type:'A'}interfaceB{type:'B'}functionassert(x:any) :asserts x is A|B{}functionfoo(x: any): any{x;// anyassert(x);x;// A | Bif(x.type==='A'){returnx;}x;// Bif(x.type==='B'){returnx;}x;// B, but should be never.// ^?}
👋 Hi, I'm the Repro bot. I can help narrow down and track compiler bugs across releases! This comment reflects the current state of the repro in the issue body running against the nightly TypeScript.
TypeScript Version: 4.0
Search Terms:
Code
Expected behavior:
the last x should be never.
Actual behavior:
still B.
Playground Link:
https://www.typescriptlang.org/play/index.html?ts=4.0.0-dev.20200615&ssl=1&ssc=1&pln=25&pc=2#code/JYOwLgpgTgZghgYwgAgIIG8BQyfLATwAcIAuAclTMwF9NNRJZEUAhLXPI0slq2zGAFcQCMMAD2IZHADOM6GAAUADxJwQ+AJTI1chTOTLkwA6gA+bOvyEixk5DHHiVJaRs2v1+ZO1zKA3DgA9EFu+Ni4svJQSsqa-hE4AcGhqMhmyCyJxjDIKgB0BMTIALxlyBRk2r4cOFAQYIJQUgHZtBzJyCGZ2cC5BUUoZSUVvNXZHPWNzYYJHO1+gV2hWdRAA
Related Issues:
The text was updated successfully, but these errors were encountered: