I recently updated a project using Flow to version 0.138.0. After the update, it's the first time I'm stumbling upon similar errors like this:
Cannot build a typed interface for this module. You should annotate the exports of this module with types. Missing type annotation at property
_dispatchUpdate: [signature-verification-failure]
Our project consists of many classes and some of them will look like this
export class SomeActions {
_interval: IntervalID;
_isPolling: boolean;
_dispatchUpdate = (downloadItems: DownloadItems[]): void => {
AppDispatcher.dispatch({
actionType: CONSTANT.CONSTANT,
downloadItems,
})
}
}
export default new SomeActions();
In order to solve the error in question, I began implementing an interface like the following
interface SomeActionsT {
_interval: IntervalID;
_ isPolling: boolean;
_dispatchUpdate: (DownloadItems[]): void;
}
export class SomeActions implements SomeActionsT {
_interval: IntervalID;
_isPolling: boolean;
_dispatchUpdate = (downloadItems: DownloadItems[]): void => {
AppDispatcher.dispatch({
actionType: CONSTANT.CONSTANT,
downloadItems,
})
}
}
export default new SomeActions();
But the flow error still exists. If I refactor the _dispatchUpdate to being a normal function, it will not complain anymore. But that's silly. How can I go about making flow recognize the arrow function?