{"action":"created","issue":{"url":"https://api.github.com/repos/facebook/flow/issues/6559","repository_url":"https://api.github.com/repos/facebook/flow","labels_url":"https://api.github.com/repos/facebook/flow/issues/6559/labels{/name}","comments_url":"https://api.github.com/repos/facebook/flow/issues/6559/comments","events_url":"https://api.github.com/repos/facebook/flow/issues/6559/events","html_url":"https://github.com/facebook/flow/issues/6559","id":337856773,"node_id":"MDU6SXNzdWUzMzc4NTY3NzM=","number":6559,"title":"Type 'string' is not compatible with type 'mixed'","user":{"login":"vale-riia","id":30522532,"node_id":"MDQ6VXNlcjMwNTIyNTMy","avatar_url":"https://avatars2.githubusercontent.com/u/30522532?v=4","gravatar_id":"","url":"https://api.github.com/users/vale-riia","html_url":"https://github.com/vale-riia","followers_url":"https://api.github.com/users/vale-riia/followers","following_url":"https://api.github.com/users/vale-riia/following{/other_user}","gists_url":"https://api.github.com/users/vale-riia/gists{/gist_id}","starred_url":"https://api.github.com/users/vale-riia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vale-riia/subscriptions","organizations_url":"https://api.github.com/users/vale-riia/orgs","repos_url":"https://api.github.com/users/vale-riia/repos","events_url":"https://api.github.com/users/vale-riia/events{/privacy}","received_events_url":"https://api.github.com/users/vale-riia/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2018-07-03T11:22:51Z","updated_at":"2018-07-03T15:25:31Z","closed_at":null,"author_association":"NONE","body":"Hello, \r\nI have run into an interesting problem which you can check [here](https://flow.org/try/#0PQKgBAAgZgNg9gdzCYAoVUCuA7AxgFwEs5sws8AKAWwE8A1AQwCcAuMWgFRoAcBTASjBsAbnEIATMAG8Avunw9e7Glz5gAvNIDaAZ3xNC2AOYBdNlUIAPXuLkYcBYqVoAxOHAr8pqMGGHMwTG5xBnwlNilsBipeNj0DYwAaMAk4-UMjGQ1pAHIomJy2ACIGIuSciUKwItwiuV9yXAogkLD+AG5UOSA)\r\n\r\n```js\r\n/* @flow */\r\n\r\nfunction func1(myVar: myType) : void {}\r\n\r\ntype myType = {[string]: mixed}\r\n\r\nfunction myFoo(){\r\n  var update : {name: string, id: string} = {'name': \"a\", 'id': \"c\"}\r\n  func1(update);\r\n}\r\n```\r\n\r\nSo basically i want to make strict type for the variable i pass into `func1` and make `myType` more generic. This does not seem to be possible. At the moment i am getting this error:\r\n\r\n```js\r\n func(update);\r\n          ^ Cannot call `func` with `update` bound to `myVar` because string [1] is incompatible with mixed [2] in property `id`.\r\nReferences:\r\n8:   var update : {name: string, id: string} = {'name': \"a\", 'id': \"c\"}\r\n                                     ^ [1]\r\n5: type myType = {[string]: mixed}\r\n                            ^ [2]\r\n9:   func(update);\r\n          ^ Cannot call `func` with `update` bound to `myVar` because string [1] is incompatible with mixed [2] in property `name`.\r\nReferences:\r\n8:   var update : {name: string, id: string} = {'name': \"a\", 'id': \"c\"}\r\n                         ^ [1]\r\n5: type myType = {[string]: mixed}\r\n```\r\nIf i make 1-to-1 match, then i don't get any errors (for example when i declare `myType` as `{[string]: string}`). \r\n\r\nAccording to the [documentation](https://flow.org/en/docs/types/mixed/#toc-anything-goes-in-nothing-comes-out), `mixed` type in `myType` should work but apparently it does not. Is there anything i am doing wrong or is it a bug?\r\n\r\n\r\nJust some additional experiments: \r\n\r\n```js\r\n/* @flow */\r\n\r\nfunction func(myVar: myType) : void {}\r\n\r\ntype myType = {[string]: string | number}\r\n\r\nfunction myFoo(){\r\n  var update : {name: string, id: string} = {'name': \"a\", 'id': \"c\"}\r\n  func(update);\r\n}\r\n\r\n```\r\ngives me this error:\r\n\r\n```js\r\nfunc(update);\r\n          ^ Cannot call `func` with `update` bound to `myVar` because string [1] is incompatible with number [2] in property `id`.\r\nReferences:\r\n8:   var update : {name: string, id: string} = {'name': \"a\", 'id': \"c\"}\r\n                                     ^ [1]\r\n5: type myType = {[string]: string | number}\r\n                                     ^ [2]\r\n9:   func(update);\r\n          ^ Cannot call `func` with `update` bound to `myVar` because string [1] is incompatible with number [2] in property `name`.\r\nReferences:\r\n8:   var update : {name: string, id: string} = {'name': \"a\", 'id': \"c\"}\r\n                         ^ [1]\r\n5: type myType = {[string]: string | number}\r\n                                     ^ [2]\r\n```\r\nSo it looks more like a problem of having 'loose' rules for object typing.\r\n"},"comment":{"url":"https://api.github.com/repos/facebook/flow/issues/comments/402196536","html_url":"https://github.com/facebook/flow/issues/6559#issuecomment-402196536","issue_url":"https://api.github.com/repos/facebook/flow/issues/6559","id":402196536,"node_id":"MDEyOklzc3VlQ29tbWVudDQwMjE5NjUzNg==","user":{"login":"apsavin","id":632171,"node_id":"MDQ6VXNlcjYzMjE3MQ==","avatar_url":"https://avatars0.githubusercontent.com/u/632171?v=4","gravatar_id":"","url":"https://api.github.com/users/apsavin","html_url":"https://github.com/apsavin","followers_url":"https://api.github.com/users/apsavin/followers","following_url":"https://api.github.com/users/apsavin/following{/other_user}","gists_url":"https://api.github.com/users/apsavin/gists{/gist_id}","starred_url":"https://api.github.com/users/apsavin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apsavin/subscriptions","organizations_url":"https://api.github.com/users/apsavin/orgs","repos_url":"https://api.github.com/users/apsavin/repos","events_url":"https://api.github.com/users/apsavin/events{/privacy}","received_events_url":"https://api.github.com/users/apsavin/received_events","type":"User","site_admin":false},"created_at":"2018-07-03T15:25:30Z","updated_at":"2018-07-03T15:25:30Z","author_association":"CONTRIBUTOR","body":"You're welcome! Please, close the issue if you have no other questions on the topic."}}
{"actor":{"display_login":"apsavin"}}