Closed

Description
TypeScript Version: 2.7.0-dev.20171112
Code
type U = { kind: "A", xs?: number[] } | { kind: "B", xs?: number[] };
function f(u: U) {
if (u.xs) {
for (const b of u.xs) {
if (u.kind === "A") {}
}
}
}
Expected behavior:
No error.
Actual behavior:
src/a.ts(4,19): error TS2532: Object is possibly 'undefined'.