Not reporting error for incompatible generics in ternary
Open
bug
- Dominant language
- Rust
- Stars
- 22.3k
- Forks
- 1.9k
- PR merge metrics
- No merged PRs in 30d
Description
Paste the following code into https://flow.org/try/
```
// @flow
type A = { aThings: number }
type B = { bStuff: string }
type ObjectMap = { [name: string]: Value }
type Action = {
type: 'SOME_REDUX_ACTION',
payload: ObjectMap
}
function reducer (state = {}, action: Action): ObjectMap {
// Expect error: ObjectMap is not ObjectMap
return action.type === 'SOME_REDUX_ACTION' ? action.payload : state
}
```
The code contains a glaring error (returning `ObjectMap` where `ObjectMap` is expected), but Flow does not catch the error. I have tried make the test case as minimal as possible.
Contributor guide
Assessment
This issue has not been assessed yet.