I think I may be running into this issue when I use import type to import the type of a Function from another file.
import type {
actionCreator,
} from 'redux/modules/reducer'
type Props = {
action: actionCreator,
}
export default class TestComponent extends PureComponent<Props> {
props: Props
onClickHandler() {
this.props.action()
// ~~~~~~~~~~~~~~~
// [flow] call of method `action` (Callable signature not found in prototype)
}
}
Is this the same issue?
Oh sorry, I need to use import typeof instead of import type. https://flow.org/en/docs/types/modules/#toc-importing-and-exporting-values
import type for classes.import typeof for instances of classes and exported values, e.g. numbers, strings, functions.Another example of something that should work that doesn't:
// This works in JS, but flow rejects
Function('return {}')()
Most helpful comment
Another example of something that should work that doesn't:
flow try
Use case in MDN docs