redux-promise-middleware-actions icon indicating copy to clipboard operation
redux-promise-middleware-actions copied to clipboard

Typescript dispatch return type

Open batusai513 opened this issue 4 years ago • 2 comments

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:

var createGroup: (data: GroupForm) => {
    type: "CREATE_GROUP";
    payload: Promise<NormalizedGroup>;
    meta: number;
}

where I'm expecting this:

var createGroup: (data: GroupForm) => Promise<{
    value: NormalizedGroup;
    action: Action<SomeAction>;
}>

batusai513 avatar Mar 31 '20 23:03 batusai513