Skip to content

Use a correct Object.entries polyfill#40268

Merged
RyanCavanaugh merged 3 commits intomicrosoft:masterfrom
RyanCavanaugh:fix40243
Aug 28, 2020
Merged

Use a correct Object.entries polyfill#40268
RyanCavanaugh merged 3 commits intomicrosoft:masterfrom
RyanCavanaugh:fix40243

Conversation

@RyanCavanaugh
Copy link
Member

Fixes #40243

The prior polyfill initialized the array slots with keys.length, then used push, creating a sparse array:

> console.log(_entries({ a: 1, b: "", c: false, 4: "d" }));

[ <4 empty items>,
  [ '4', 'd' ],
  [ 'a', 1 ],
  [ 'b', '' ],
  [ 'c', false ] ]

@RyanCavanaugh RyanCavanaugh requested a review from rbuckton August 26, 2020 15:39
@typescript-bot typescript-bot added Author: Team For Milestone Bug PRs that fix a bug with a specific milestone labels Aug 26, 2020
@DanielRosenwasser
Copy link
Member

Please make sure this gets ported to tslib as well if you merge it

RyanCavanaugh and others added 2 commits August 27, 2020 21:14
Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>
@DanielRosenwasser
Copy link
Member

😂 sorry, I totally forgot about that. That must've been painful without a good error message.

@RyanCavanaugh RyanCavanaugh merged commit b969b58 into microsoft:master Aug 28, 2020
@RyanCavanaugh RyanCavanaugh deleted the fix40243 branch August 28, 2020 16:10
@microsoft microsoft locked as resolved and limited conversation to collaborators Oct 21, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Author: Team For Milestone Bug PRs that fix a bug with a specific milestone

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Object.entries implements code error!

4 participants