Flow can't seem to choose between union types
Open
Typing: refinements
Typing: tuple
- Dominant language
- Rust
- Stars
- 22.3k
- Forks
- 1.9k
- PR merge metrics
- No merged PRs in 30d
Description
[try flow](https://flow.org/try/#0CYUwxgNghgTiAEAzArgOzAFwJYHtXwHMRUAKASgC54BtAURhhxgBp5VkIIBdeAHxvadW7ALYAjEDC4BuAFCyweAM4Yaklm2TjJPALyFi5ObKyJ4JAITqy8AN6yAkCVESYVF5LKyAvrKA)
```js
declare function gen(): [Error, null] | [null, number];
const [err, number] = gen();
if (!err) {
(number: number)
}
```
that last cast throws an error that `number` can be `null` even though the `if` statement should force `(err: null)` and `(number: number)`
Any suggestions on how to re-write this would be appreciated!
Contributor guide
Assessment
This issue has not been assessed yet.