-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
Object.entries implements code error! #40243
Labels
Milestone
Comments
RyanCavanaugh
added
the
Working as Intended
The behavior described is the intended behavior; this is not a bug
label
Aug 25, 2020
The proposed diff would fail to run. Please be more explicit about why you think this is wrong |
var result = Array(keys.length); result[0 .. keys.length] is undefined entries push after result[keys.length] |
it is run normally because most javascript has Object.entries function. |
RyanCavanaugh
removed
the
Working as Intended
The behavior described is the intended behavior; this is not a bug
label
Aug 26, 2020
I misread "Expected" and "Actual" - yes, this is indeed broken. |
RyanCavanaugh
added a commit
to RyanCavanaugh/TypeScript
that referenced
this issue
Aug 26, 2020
RyanCavanaugh
added a commit
that referenced
this issue
Aug 28, 2020
* Use a correct Object.entries polyfill Fixes #40243 * Update src/compiler/core.ts Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com> * Added parentheses, DANIEL. Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
TypeScript Version: 4.0.2
Search Terms:
Code
typescript.js at line 1479
Expected behavior:
var _entries = Object.entries ? Object.entries : function (obj) {
var keys = getOwnKeys(obj);
var result = Array(keys.length);
for (var _i = 0, keys_1 = keys; _i < keys_1.length; _i++) {
var key = keys_1[_i];
result[i] = [key, obj[key]];
}
return result;
};
Actual behavior:
var _entries = Object.entries ? Object.entries : function (obj) {
var keys = getOwnKeys(obj);
var result = Array(keys.length);
for (var _i = 0, keys_1 = keys; _i < keys_1.length; _i++) {
var key = keys_1[_i];
result.push([key, obj[key]]);
}
return result;
};
Playground Link:
Related Issues:
The text was updated successfully, but these errors were encountered: