Open
Description
If the type of the member checked is not falsy (and so is never
in the false branch).
TypeScript Version: 2.7.0-dev.201xxxxx
Code
const x: {a: 1, b: 2} = { a: 1, b: 2 };
if (x.a) {
}
else {
x.a;
}
Expected behavior:
type of x
in the else
branch is never
.
Actual behavior:
type of x
is {a: 1. b: 2}
, and x.a
is (counterintuitively) never
.
This would bring the behavior of truthiness guards in line with our new behavior for in
type guards.