{"action":"created","issue":{"url":"https://api.github.com/repos/facebook/flow/issues/1915","repository_url":"https://api.github.com/repos/facebook/flow","labels_url":"https://api.github.com/repos/facebook/flow/issues/1915/labels{/name}","comments_url":"https://api.github.com/repos/facebook/flow/issues/1915/comments","events_url":"https://api.github.com/repos/facebook/flow/issues/1915/events","html_url":"https://github.com/facebook/flow/issues/1915","id":159377211,"number":1915,"title":"Can't filter types with Array.filter","user":{"login":"funtaps","id":1251799,"avatar_url":"https://avatars.githubusercontent.com/u/1251799?v=3","gravatar_id":"","url":"https://api.github.com/users/funtaps","html_url":"https://github.com/funtaps","followers_url":"https://api.github.com/users/funtaps/followers","following_url":"https://api.github.com/users/funtaps/following{/other_user}","gists_url":"https://api.github.com/users/funtaps/gists{/gist_id}","starred_url":"https://api.github.com/users/funtaps/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/funtaps/subscriptions","organizations_url":"https://api.github.com/users/funtaps/orgs","repos_url":"https://api.github.com/users/funtaps/repos","events_url":"https://api.github.com/users/funtaps/events{/privacy}","received_events_url":"https://api.github.com/users/funtaps/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/facebook/flow/labels/Closed:%20duplicate","name":"Closed: duplicate","color":"ffffff"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-06-09T10:37:57Z","updated_at":"2016-06-17T08:39:47Z","closed_at":"2016-06-17T08:39:47Z","body":"It's impossible to filter element by type with Array.filter.\r\nHere is example of valid code, that flow don't want to accept.\r\n\r\n```javascript\r\n// @flow\r\nconst input: Array<number|string> = [1, 'a', 2, 3, 'b'];\r\nconst result: Array<number> = input.filter(el => {\r\n  return typeof el == 'number';\r\n});\r\n```\r\n\r\nIt returns\r\n\r\n    3: const result: Array<number> = input.filter(el => {\r\n                                      ^ call of method `filter`\r\n    2: const input: Array<number|string> = [1, 'a', 2, 3, 'b'];\r\n                                      ^^^^^^ string. This type is incompatible with\r\n    3: const result: Array<number> = input.filter(el => {\r\n                            ^^^^^^ number\r\n\r\nFlow version 0.26.0"},"comment":{"url":"https://api.github.com/repos/facebook/flow/issues/comments/226713613","html_url":"https://github.com/facebook/flow/issues/1915#issuecomment-226713613","issue_url":"https://api.github.com/repos/facebook/flow/issues/1915","id":226713613,"user":{"login":"avikchaudhuri","id":5328177,"avatar_url":"https://avatars.githubusercontent.com/u/5328177?v=3","gravatar_id":"","url":"https://api.github.com/users/avikchaudhuri","html_url":"https://github.com/avikchaudhuri","followers_url":"https://api.github.com/users/avikchaudhuri/followers","following_url":"https://api.github.com/users/avikchaudhuri/following{/other_user}","gists_url":"https://api.github.com/users/avikchaudhuri/gists{/gist_id}","starred_url":"https://api.github.com/users/avikchaudhuri/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/avikchaudhuri/subscriptions","organizations_url":"https://api.github.com/users/avikchaudhuri/orgs","repos_url":"https://api.github.com/users/avikchaudhuri/repos","events_url":"https://api.github.com/users/avikchaudhuri/events{/privacy}","received_events_url":"https://api.github.com/users/avikchaudhuri/received_events","type":"User","site_admin":false},"created_at":"2016-06-17T08:39:47Z","updated_at":"2016-06-17T08:39:47Z","body":"Duplicate of #1414 "}}
{"actor":{"display_login":"avikchaudhuri"}}