TypeScript Version: 2.3.1
Code
const foo: object & {} = {bar: 'bar'};
Expected behavior:
No error.
Actual behavior:
I get the following error:
Type '{ bar: string; }' is not assignable to type 'object & {}'.
Object literal may only specify known properties, and 'bar' does not exist in type 'object & {}'.
This error is not present in 2.2 or 2.3-rc. Interestingly enough, the following all work fine:
const foo1: object = {bar: 'bar'};
const foo2: {} = {bar: 'bar'};
class Bar {}
const bar = new Bar();
const foo3: Bar & {} = bar;
TypeScript Version: 2.3.1
Code
Expected behavior:
No error.
Actual behavior:
I get the following error:
This error is not present in 2.2 or 2.3-rc. Interestingly enough, the following all work fine: