Skip to content

Use a correct Object.entries polyfill #40268

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 28, 2020

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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