`boolean` is incompatible with `true | false`
- Dominant language
- Rust
- Stars
- 22.3k
- Forks
- 1.9k
- PR merge metrics
- No merged PRs in 30d
Description
Flow does not let you pass a `boolean` where `(true | false)` is accepted.
```js
// @flow
declare function foo(true | false): void
declare function bar(): (boolean)
foo(bar())
```
This [fails](https://flow.org/try/#0PTAEAEDMBsHsHcBQiAmBTAxtAhgJzaJAK4B2GALgJawmgYAWssAzmgBTm5EEA+h20VgEoAXKABusSilSYc+QqQrVa6DNPajQbAEZNoabCSHIGTVmzUa2Qk4jMt2zStGgBPS5mu27xMlRpQZ1cPcTE9WAMjIVAAb0RQUHxyIlxacVAAflBOblAxSAFWRABfRCA) with the following error:
```
6: foo(bar())
^ boolean. This type is incompatible with
3: declare function foo(true | false): void
^ union: boolean literal `true` | boolean literal `false`
```
Why is this? I would expect `boolean` to be defined internally as just `true | false`, but that seems not to be the case.
Contributor guide
Assessment
This issue has not been assessed yet.