{"action":"opened","issue":{"url":"https://api.github.com/repos/facebook/flow/issues/843","labels_url":"https://api.github.com/repos/facebook/flow/issues/843/labels{/name}","comments_url":"https://api.github.com/repos/facebook/flow/issues/843/comments","events_url":"https://api.github.com/repos/facebook/flow/issues/843/events","html_url":"https://github.com/facebook/flow/issues/843","id":107622709,"number":843,"title":"State cannot be a union in a class derived from ReactComponent","user":{"login":"pasha-mf","id":11412485,"avatar_url":"https://avatars.githubusercontent.com/u/11412485?v=3","gravatar_id":"","url":"https://api.github.com/users/pasha-mf","html_url":"https://github.com/pasha-mf","followers_url":"https://api.github.com/users/pasha-mf/followers","following_url":"https://api.github.com/users/pasha-mf/following{/other_user}","gists_url":"https://api.github.com/users/pasha-mf/gists{/gist_id}","starred_url":"https://api.github.com/users/pasha-mf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pasha-mf/subscriptions","organizations_url":"https://api.github.com/users/pasha-mf/orgs","repos_url":"https://api.github.com/users/pasha-mf/repos","events_url":"https://api.github.com/users/pasha-mf/events{/privacy}","received_events_url":"https://api.github.com/users/pasha-mf/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-09-22T00:12:35Z","updated_at":"2015-09-22T00:12:35Z","closed_at":null,"body":"```\r\ntype StateA = { mode: \"visible\"; flipped:  boolean; };\r\ntype StateB = { mode: \"hidden\"; };\r\ntype TestCardState = StateA | StateB;\r\n\r\nclass TestCard extends ReactComponent {\r\n  static defaultProps: {};\r\n  props: {};\r\n  state: TestCardState;\r\n\r\n  constructor() {\r\n    super();\r\n    this.state = {mode: \"hidden\"};\r\n  }\r\n\r\n  test() {\r\n    this.setState({mode: \"visible\", flipped: true});\r\n  }\r\n}\r\n```\r\nFlow complains about the setState invocation:\r\n```\r\ntest.js:24:5,51: call of method setState\r\nError:\r\ntest.js:13:24,37: prop `flipped` of type parameter `S` of class type: identifier ReactComponent\r\nProperty not found in\r\ntest.js:10:15,33: object type\r\n\r\ntest.js:24:5,51: call of method setState\r\nError:\r\ntest.js:24:26,34: string\r\nExpected string literal hidden, got visible instead\r\ntest.js:10:23,30: string literal hidden\r\n```"}}