{"action":"closed","issue":{"url":"https://api.github.com/repos/facebook/flow/issues/3485","repository_url":"https://api.github.com/repos/facebook/flow","labels_url":"https://api.github.com/repos/facebook/flow/issues/3485/labels{/name}","comments_url":"https://api.github.com/repos/facebook/flow/issues/3485/comments","events_url":"https://api.github.com/repos/facebook/flow/issues/3485/events","html_url":"https://github.com/facebook/flow/issues/3485","id":212474505,"number":3485,"title":"Can't cast map/array of subclasses to map/array of base classes","user":{"login":"bdrobinsonbbc","id":12748527,"avatar_url":"https://avatars1.githubusercontent.com/u/12748527?v=3","gravatar_id":"","url":"https://api.github.com/users/bdrobinsonbbc","html_url":"https://github.com/bdrobinsonbbc","followers_url":"https://api.github.com/users/bdrobinsonbbc/followers","following_url":"https://api.github.com/users/bdrobinsonbbc/following{/other_user}","gists_url":"https://api.github.com/users/bdrobinsonbbc/gists{/gist_id}","starred_url":"https://api.github.com/users/bdrobinsonbbc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bdrobinsonbbc/subscriptions","organizations_url":"https://api.github.com/users/bdrobinsonbbc/orgs","repos_url":"https://api.github.com/users/bdrobinsonbbc/repos","events_url":"https://api.github.com/users/bdrobinsonbbc/events{/privacy}","received_events_url":"https://api.github.com/users/bdrobinsonbbc/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2017-03-07T15:55:17Z","updated_at":"2017-03-07T17:40:27Z","closed_at":"2017-03-07T17:40:27Z","body":"When I do\r\n\r\n```js\r\nclass A {}\r\n\r\nclass B extends A {}\r\n\r\nconst bMap: Map<string, B> = new Map()\r\nconst aMap: Map<string, A> = bMap\r\n```\r\n\r\nI get an error saying that `A` is incompatible with `B`. The same also seems to apply to arrays. I feel like it ought to be possible to cast in this way, since flow is happy for me to do\r\n\r\n```js\r\nconst a: A = new B()\r\n```\r\n\r\nas it can recognise that `B` is a subclass of `A` and so is a valid operation.\r\n\r\nIs this something that just hasn't been implemented yet, or is there a good reason it won't let me do this? I'm aware I could get around it by cloning the Map."}}
{"actor":{"display_login":"vkurchatkin"}}