Closed
Description
TypeScript Version: 2.1.4 / 2.1.4-insiders.20161201
Code
interface IFoo {
foo?: number;
bar?: number;
}
let a: IFoo = {
foo: 1,
asd: 2 // this line shows error
};
let b = true;
let c: IFoo =
b ? {
asd: 2 // this line shows error
} : {
foo: 1,
asd: 2 // this line does NOT show an error
}
Also this version fails:
let c: IFoo =
b ? {
} : {
foo: 1,
asd: 2 // this line does NOT show an error
}
Expected behavior:
All asd:2
assignments should show an error
Actual behavior:
Only the first two show the error, the last one does not.