-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Closed
Labels
Design LimitationConstraints of the existing architecture prevent this from being fixedConstraints of the existing architecture prevent this from being fixed
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.
Metadata
Metadata
Assignees
Labels
Design LimitationConstraints of the existing architecture prevent this from being fixedConstraints of the existing architecture prevent this from being fixed