Open
Description
type Props = $ReadOnly<{
actionId: string,
onPress: (args:{dispatch: () => void}) => void
}> | $ReadOnly<{
actionId?:void,
onPress: () => void
}>
const A: (p:Props) => void = () => {}
const actionId: string = `1`
A({
actionId,
onPress:({dispatch}) => {dispatch()}
// ^ property `dispatch` is missing in undefined [1]. [incompatible-use]
})
A({
actionId: ''.concat(''),
onPress:({dispatch}) => {dispatch()}
// ^ property `dispatch` is missing in undefined [1]. [incompatible-use]
})
A({
actionId: '1',
onPress:({dispatch}) => {dispatch()}
// no error like it should be
})
Flow version: 0.259.1
Expected behavior
No error.
Actual behavior
Flow treats "dynamic" strings in a different way.
- Link to Try-Flow or Github repo:
Activity