I'm trying to check some code with flowtype:
export default function configureStore(initialState: initialStateType) {
/* ... */
if (module && module.hot) {
module.hot.accept('../reducers', () => {
const nextRootReducer = require('../reducers');
store.replaceReducer(nextRootReducer);
});
}
/* ... */
}
And I'm getting this error message:
src/store/configureStore.js:14
14: module.hot.accept('../reducers', () => {
^ call of method `accept`. Method cannot be called on
14: module.hot.accept('../reducers', () => {
^^^^^^^^^^ property `hot` of unknown type
How can I fix this?
Thanks!
You need to add the following declare to a file that you point to in your .flowconfig's [libs] section. You can find more information about adding library definition files here: https://flow.org/en/docs/libdefs/
declare var module : {
hot : {
accept(path:string, callback:() => void): void;
};
};
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With