Closed

Description
TypeScript Version: nightly (2.3.0-dev.20170313)
Code
interface A {
foo?: { x: number };
bar?: { y: number };
}
function f(a: A) {
if (a.foo && a.bar) {
const xx = a.foo.x; const yy = a.bar.y; // No error
const { foo: { x }, bar: { y } } = a; // Error
}
}
Expected behavior:
No errors.
Actual behavior:
a.ts(9,24): error TS2459: Type '{ x: number; } | undefined' has no property 'x' and no string index signature.
a.ts(9,36): error TS2459: Type '{ y: number; } | undefined' has no property 'y' and no string index signature.