I'm implementing redux-dynamic-modules in my application and it is not the first module in my app, but I get strange error when I try to create this module:
export const reduxProfile = () => {
return {
id: 'profile',
reducerMap: {
profile: reducer
},
sagas: [profileSagas],
retained: true
}
}
Type 'Reducer<ProfileState, Action>' is not assignable to type 'Reducer<any, AnyAction>'. Types of parameters 'action' and 'action' are incompatible. Type 'AnyAction' is not assignable to type 'Action'. Type 'AnyAction' is not assignable to type 'SetPriceAction'.
And here's my SetPriceAction which seems to look just fine:
export interface SetPriceAction extends AnyAction {
payload: Result;
type: ActionTypes.SET_PRICE;
}
...
export type Action =
| ...
| SetPriceAction;
In another module is pretty much of the same shape, and everything works fine there. Can anybody help what went wrong here?
A quick bypass would be to set your payload as optional.
export interface SetPriceAction extends AnyAction {
payload?: Result;
type: ActionTypes.SET_PRICE;
}
But I am actively looking for a long term solution requiring the payload to be defined. I'll let you know if I make any progress on the matter
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