Open batusai513 opened 4 years ago
It is returning the first types because it is still a plain action for redux. The redux-promise-middleware will see that the payload is a promise and output three new actions: pending and error/success. We can't output the latter type you write since it's not a simple POJO redux action so redux wouldn't understand it.
@omichelsen I understand, but I think after it has been processed by the middleware there should be way to get the correct types, in case one want to handle the promise after it has been dispatched, maybe it's related to redux-promise-middleware
itself?.
dispatch(createGroup())
/*
return type should be this
Promise<{
value: NormalizedGroup;
action: Action<SomeAction>;
}>
*/
Hi, Is there an example on how to use the library with Typescript, How do I transform the return of the createAsyncAction after dispatching it, for example, I have an createGroup action and after dispatching it, the return type is this:
where I'm expecting this: