{"action":"opened","issue":{"url":"https://api.github.com/repos/facebook/flow/issues/4593","repository_url":"https://api.github.com/repos/facebook/flow","labels_url":"https://api.github.com/repos/facebook/flow/issues/4593/labels{/name}","comments_url":"https://api.github.com/repos/facebook/flow/issues/4593/comments","events_url":"https://api.github.com/repos/facebook/flow/issues/4593/events","html_url":"https://github.com/facebook/flow/issues/4593","id":249949098,"number":4593,"title":"Disjoint union refinement doesn't work with Date type","user":{"login":"eenagy","id":4188977,"avatar_url":"https://avatars1.githubusercontent.com/u/4188977?v=4","gravatar_id":"","url":"https://api.github.com/users/eenagy","html_url":"https://github.com/eenagy","followers_url":"https://api.github.com/users/eenagy/followers","following_url":"https://api.github.com/users/eenagy/following{/other_user}","gists_url":"https://api.github.com/users/eenagy/gists{/gist_id}","starred_url":"https://api.github.com/users/eenagy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eenagy/subscriptions","organizations_url":"https://api.github.com/users/eenagy/orgs","repos_url":"https://api.github.com/users/eenagy/repos","events_url":"https://api.github.com/users/eenagy/events{/privacy}","received_events_url":"https://api.github.com/users/eenagy/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-08-14T07:11:17Z","updated_at":"2017-08-14T07:11:17Z","closed_at":null,"body":"I was doing Date refinement following the official [docs](https://flow.org/en/docs/types/unions/#disjoint-unions-with-exact-types-a-classtoc-idtoc-disjoint-unions-with-exact-types-hreftoc-disjoint-unions-with-exact-typesa) and excepted that no error message will be thrown\r\n\r\n```\r\n// This is from official docs\r\ntype Success = {| success: true, value: boolean |};\r\ntype Failed  = {| error: true, message: string |};\r\n\r\ntype Response = Success | Failed;\r\n\r\nfunction handleResponse(response: Response) {\r\n  if (response.success) {\r\n    var value: boolean = response.value;\r\n  } else {\r\n    var message: string = response.message;\r\n  }\r\n}\r\n\r\n// Here is for Date type\r\n\r\ntype dateParts = {| day?: string, month?: string, year?: string |};\r\n\r\ntype dateOrObject = dateParts | Date;\r\nconst value: dateOrObject = { year: '2017'};\r\nif (value.year) { // does not work\r\n  const { day, month, year } = value;\r\n}\r\nif (! (value instanceof Date)) { // works\r\n  const { day, month, year } = value;\r\n}\r\n```\r\n\r\n\r\nHere is the [reproduction](https://flow.org/try/#0PTAEBUAsEsGdTqAZgJwPYFtRqU6BjaAQwBtQATNfWAKABcBPABwFNQBlAV33xdngC8oAN4AfULG69+ALlB0UnFgBpQAN1JK5AIzRoSLIgDtQogL4BueszYAxItAPlQoIWNAsU6FHIVLVGHywRADmLHKwCtBGIaaWNNasoABKfExoRrBsQlw8Qaag9o4s5FY0SJxG+HTQGaCQxuQGqbDpmSwAFChpGVlyLW1ZAJQiNC7QSKBdPe0AdJJ5-CPCYy7qRCjrJFqguvqGJkLdrb0ssxrbLFYuZh4kWaNr65uB-KHhElExrqDHg2evYJha6gMw0ME0ECgAASnjYiCQaE2ABEiHQ2IxWAlMWxyGiWAAFDZ0QQicR4hgAfgiXxCAQydEg1M+KGidNADEMKGZkVZ33MZRxFHxAHkUCLtAArFjVH549FElAkgqo9FWfC9OhbHbylhiiXS2VuDlcuQAcgATAAGACMAHYzfEJlMLkpZpyNstQFDKHxQEY0FqAO5IgDWqw1mS1wmFDHpRkZqg9m1uQldV3BNGdHQAhC7NPCo8ZeDhQKqWEMvVCQyhQ7QXJHIiJY-HEyaNqCfumrGYgA)\r\n\r\nEi"}}
{"actor":{"display_login":"eenagy"}}