Open
Description
TypeScript Version: 2.7.1
Search Terms: Object entries empty TS2365
Code
let o: any = {x: 5};
let p = Object.entries(o).map(([k, v]) => v + 1);
Compile command: tsc --lib es2017,es2017.object a.ts
Expected behavior:
This should compile without any error, assuming v: any
.
This was the case for Typescript 2.6.2 at least.
Actual behavior:
(3,43): error TS2365: Operator '+' cannot be applied to types '{}' and '1'.
Following codes compile without errors:
let o: object = {x: 5};
let p = Object.entries(o).map(([k, v]) => v + 1);
let o: any = {x: 5};
let p = Object.entries(o).map(([k, v]: [any, any]) => v + 1);