Closed
Description
#11587 allows us to do this:
function test(a: 'a' | string) {
if (a == 'a') {
a // <- type: 'a'
}
}
It would be great if the following could also work:
type Z = {type:'a',a:string}|{type:string,b:string}
function test(a: Z) {
if (a.type == 'a') {
a // <- type: Z but ideally if it could be {type:'a',a:string}
}
}