{"action":"created","issue":{"url":"https://api.github.com/repos/HurricaneJames/react-immutable-proptypes/issues/17","labels_url":"https://api.github.com/repos/HurricaneJames/react-immutable-proptypes/issues/17/labels{/name}","comments_url":"https://api.github.com/repos/HurricaneJames/react-immutable-proptypes/issues/17/comments","events_url":"https://api.github.com/repos/HurricaneJames/react-immutable-proptypes/issues/17/events","html_url":"https://github.com/HurricaneJames/react-immutable-proptypes/pull/17","id":123756885,"number":17,"title":"Bug fix for createIterableTypeChecker passing propValue incorrectly","user":{"login":"MatthewHerbst","id":1287375,"avatar_url":"https://avatars.githubusercontent.com/u/1287375?v=3","gravatar_id":"","url":"https://api.github.com/users/MatthewHerbst","html_url":"https://github.com/MatthewHerbst","followers_url":"https://api.github.com/users/MatthewHerbst/followers","following_url":"https://api.github.com/users/MatthewHerbst/following{/other_user}","gists_url":"https://api.github.com/users/MatthewHerbst/gists{/gist_id}","starred_url":"https://api.github.com/users/MatthewHerbst/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MatthewHerbst/subscriptions","organizations_url":"https://api.github.com/users/MatthewHerbst/orgs","repos_url":"https://api.github.com/users/MatthewHerbst/repos","events_url":"https://api.github.com/users/MatthewHerbst/events{/privacy}","received_events_url":"https://api.github.com/users/MatthewHerbst/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-12-24T04:27:34Z","updated_at":"2015-12-26T18:33:01Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/HurricaneJames/react-immutable-proptypes/pulls/17","html_url":"https://github.com/HurricaneJames/react-immutable-proptypes/pull/17","diff_url":"https://github.com/HurricaneJames/react-immutable-proptypes/pull/17.diff","patch_url":"https://github.com/HurricaneJames/react-immutable-proptypes/pull/17.patch"},"body":"Let's say that the following is a validation I've set up in my component:\r\n\r\n```javascript\r\nimport React from 'react';\r\nimport ImmutablePropTypes from 'react-immutable-proptypes';\r\n\r\nvar MyComponent = React.createClass({\r\n  propTypes: {\r\n    someImmutableList: ImmutablePropTypes.listOf(myAwesomeListValidator)\r\n  },\r\n  render: function() {...}\r\n});\r\n\r\nfunction myAwesomeListValidator(list, idx, componentName, location) {\r\n  var currListItem = list.get(idx);\r\n  ...\r\n}\r\n```\r\n\r\nIf you try running the above, you will get an error along the lines of:\r\n\r\n```\r\nWarning: Failed propType: list.get is not a function ...\r\n```\r\n\r\nI literally spent hours trying to figure out what I had done to my prop to somehow make it not a list. But it didn't make any sense, since putting a `console.log(this.props.someImmutableList)` easily shows it is an Immutable list. Well, after some code hunting, I found this in the current source:\r\n\r\n```javascript\r\nvar propValues = propValue.toArray();\r\n```\r\n\r\nWell now it all makes total sense! So, this changes fixes this (what I deem a bug) by preserving the Immutable structure, and replacing the for loop for `forEach`, [a method that all Immutable.js structure inherit from Immutable.Iterable](http://facebook.github.io/immutable-js/docs/#/Iterable/forEach).\r\n\r\n*Warning:* this change will potentially break existing code for anyone who has provided a custom typechecker to `ImmutablePropTypes.listOf`. However, in the long run their code should change - ideally there is no reason to ever not use Immutable.js objects completely."},"comment":{"url":"https://api.github.com/repos/HurricaneJames/react-immutable-proptypes/issues/comments/167353298","html_url":"https://github.com/HurricaneJames/react-immutable-proptypes/pull/17#issuecomment-167353298","issue_url":"https://api.github.com/repos/HurricaneJames/react-immutable-proptypes/issues/17","id":167353298,"user":{"login":"MatthewHerbst","id":1287375,"avatar_url":"https://avatars.githubusercontent.com/u/1287375?v=3","gravatar_id":"","url":"https://api.github.com/users/MatthewHerbst","html_url":"https://github.com/MatthewHerbst","followers_url":"https://api.github.com/users/MatthewHerbst/followers","following_url":"https://api.github.com/users/MatthewHerbst/following{/other_user}","gists_url":"https://api.github.com/users/MatthewHerbst/gists{/gist_id}","starred_url":"https://api.github.com/users/MatthewHerbst/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MatthewHerbst/subscriptions","organizations_url":"https://api.github.com/users/MatthewHerbst/orgs","repos_url":"https://api.github.com/users/MatthewHerbst/repos","events_url":"https://api.github.com/users/MatthewHerbst/events{/privacy}","received_events_url":"https://api.github.com/users/MatthewHerbst/received_events","type":"User","site_admin":false},"created_at":"2015-12-26T18:33:01Z","updated_at":"2015-12-26T18:33:01Z","body":"Thanks for getting back so quick!\r\n\r\nI'll play around with it and update the pr if I find something that works and isn't ugly. If we decide to leave it the way it is, might be good to update the docs to make it clear what's going on."}}