{"action":"created","issue":{"url":"https://api.github.com/repos/flow-typed/flow-typed/issues/1330","repository_url":"https://api.github.com/repos/flow-typed/flow-typed","labels_url":"https://api.github.com/repos/flow-typed/flow-typed/issues/1330/labels{/name}","comments_url":"https://api.github.com/repos/flow-typed/flow-typed/issues/1330/comments","events_url":"https://api.github.com/repos/flow-typed/flow-typed/issues/1330/events","html_url":"https://github.com/flow-typed/flow-typed/issues/1330","id":264077348,"node_id":"MDU6SXNzdWUyNjQwNzczNDg=","number":1330,"title":"lodash_v4.x.x type of object key in _.find","user":{"login":"liamfd","id":5359538,"node_id":"MDQ6VXNlcjUzNTk1Mzg=","avatar_url":"https://avatars2.githubusercontent.com/u/5359538?v=4","gravatar_id":"","url":"https://api.github.com/users/liamfd","html_url":"https://github.com/liamfd","followers_url":"https://api.github.com/users/liamfd/followers","following_url":"https://api.github.com/users/liamfd/following{/other_user}","gists_url":"https://api.github.com/users/liamfd/gists{/gist_id}","starred_url":"https://api.github.com/users/liamfd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/liamfd/subscriptions","organizations_url":"https://api.github.com/users/liamfd/orgs","repos_url":"https://api.github.com/users/liamfd/repos","events_url":"https://api.github.com/users/liamfd/events{/privacy}","received_events_url":"https://api.github.com/users/liamfd/received_events","type":"User","site_admin":false},"labels":[{"id":261936120,"node_id":"MDU6TGFiZWwyNjE5MzYxMjA=","url":"https://api.github.com/repos/flow-typed/flow-typed/labels/bug","name":"bug","color":"d93f0b","default":true},{"id":874822104,"node_id":"MDU6TGFiZWw4NzQ4MjIxMDQ=","url":"https://api.github.com/repos/flow-typed/flow-typed/labels/libdef","name":"libdef","color":"0052cc","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-10-10T02:11:58Z","updated_at":"2018-09-24T11:15:25Z","closed_at":null,"author_association":"NONE","body":"Hello,\r\n\r\nWithin the lodash type definiton, a few functions look like this:\r\n\r\n```\r\n    // ... the array version\r\n    find<V, A, T: { [id: string]: A }>(\r\n      object: T,\r\n      predicate?: OPredicate<A, T>,\r\n      fromIndex?: number\r\n    ): V,\r\n```\r\n\r\nI was wondering if it would be possible to remove or loosen the restriction that the the `id`s of the `T` object be strings. Flow seems to allow any type to be used as an indexer property. While I'm not suggesting its a good idea to use things like objects as keys, I think its fairly common to have non string indexer properties of types that can be cast to strings more elegantly. For instance, I have something like this:\r\n\r\n```javascript\r\ntype User = {id: number, name: string};\r\ntype MyMap = {[id: number]: User};\r\nconst findUser = (user_map: MyMap) => {\r\n  return _.find(user_map, user => user.name === 'John Smith');\r\n};\r\n```\r\n\r\nWhich appears to work properly in lodash, but throws a type error about the indexer property not being a string:\r\n\r\n```\r\n  Error:\r\n  127: export const findMyEntity = (entity_map: {[number]: MyEntity}) => {\r\n                                                  ^^^^^^ number. This type is incompatible with\r\n  340:     find<V, A, T: { [id: string]: A }>(\r\n                                ^^^^^^ string. See lib: flow-typed/npm/lodash_v4.x.x.js:340\r\n```\r\n\r\nIs there anything in lodash or Flow that would prevent us from relaxing this restriction by using either an enum of reasonable key types (ie. `string | number`) or even something like `{ [id: *]: A }`?\r\n\r\nI'd be happy to try my hand at a pull request, just wanted to clarify whether or not this was intended before I jumped in."},"comment":{"url":"https://api.github.com/repos/flow-typed/flow-typed/issues/comments/423941636","html_url":"https://github.com/flow-typed/flow-typed/issues/1330#issuecomment-423941636","issue_url":"https://api.github.com/repos/flow-typed/flow-typed/issues/1330","id":423941636,"node_id":"MDEyOklzc3VlQ29tbWVudDQyMzk0MTYzNg==","user":{"login":"guyfedwards","id":1794071,"node_id":"MDQ6VXNlcjE3OTQwNzE=","avatar_url":"https://avatars3.githubusercontent.com/u/1794071?v=4","gravatar_id":"","url":"https://api.github.com/users/guyfedwards","html_url":"https://github.com/guyfedwards","followers_url":"https://api.github.com/users/guyfedwards/followers","following_url":"https://api.github.com/users/guyfedwards/following{/other_user}","gists_url":"https://api.github.com/users/guyfedwards/gists{/gist_id}","starred_url":"https://api.github.com/users/guyfedwards/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guyfedwards/subscriptions","organizations_url":"https://api.github.com/users/guyfedwards/orgs","repos_url":"https://api.github.com/users/guyfedwards/repos","events_url":"https://api.github.com/users/guyfedwards/events{/privacy}","received_events_url":"https://api.github.com/users/guyfedwards/received_events","type":"User","site_admin":false},"created_at":"2018-09-24T11:15:25Z","updated_at":"2018-09-24T11:15:25Z","author_association":"NONE","body":"I would also like to add the usecase of an object thats keyed by an opaque type, this results in `MyOpaque is incompatible with string in the indexer property`"}}
{"actor":{"display_login":"guyfedwards"}}