-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Open
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: lib.d.tsThe issue relates to the different libraries shipped with TypeScriptThe issue relates to the different libraries shipped with TypeScript
Milestone
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);
skosch, SlurpTheo, apoco, freddi301, piousdeer and 8 more
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: lib.d.tsThe issue relates to the different libraries shipped with TypeScriptThe issue relates to the different libraries shipped with TypeScript