facebook / facebook/flow

Building a disjoint union fails in simple situation

Open
#7,956 1 comment 0 reactions 0 assignees View on GitHub
bug Typing: unions/intersections
Dominant language
Rust
Stars
22.3k
Forks
1.9k
PR merge metrics
No merged PRs in 30d

Description

When building a simple object that should be the type of a disjoint union, flow gives the error that it doesn't know which case is correct, even after it should have refined the type due to the prior condition. I am confused as to why this is happening because it seems like a very simple case that I would have expected Flow to handle easily.

[Flow try](https://flow.org/try/#0C4TwDgpgBAKgFgSwHYHMoF4BQBIAPlAbx221EgC4oByAQSoBpjsBnYAJ2RQGkIRLWOqRtihQAvjnwEoZCJSoAhKuMmEZ4OdQDCyiZlmxEqGBozU6UfIuVWdmTADMArkgDGwBAHskUALYBDAGsIeE4ACllKUOMNAEooozQiUVdvVhlEhM4zA3Q882UAfjVZeigBTh4+amAIVl0oSmkDCVE2CGAnNh9gRMwxIA)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.