-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Open
Labels
Typing: completenessNo false positives (type checker claims that there are some errors in the correct program)No false positives (type checker claims that there are some errors in the correct program)bug
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:
Metadata
Metadata
Assignees
Labels
Typing: completenessNo false positives (type checker claims that there are some errors in the correct program)No false positives (type checker claims that there are some errors in the correct program)bug