Skip to content

fix #14187, forIn should allow non primitive object as right hand side#14195

Merged
mhegazy merged 1 commit into
microsoft:masterfrom
HerringtonDarkholme:object-iteration
Mar 23, 2017
Merged

fix #14187, forIn should allow non primitive object as right hand side#14195
mhegazy merged 1 commit into
microsoft:masterfrom
HerringtonDarkholme:object-iteration

Conversation

@HerringtonDarkholme
Copy link
Copy Markdown
Contributor

Fixes #14187

// assignable to right hand side of forIn
for (var key in a) {
var val = a[key]
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test (conformance/types/nonPrimitive/assignObjectToNonPrimitive.ts) seems unrelated - would it be possible to remove this and create a new test? Something like conformance/types/nonPrimitive/indexingWithForInLoop01.ts seems more appropriate.

var a: object;

for (var key in a) {
var value = a[key]; // error
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But this isn't an error, right?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants