UNPKG

react-redux-dispatch-async

Version:

hooks & redux middleware to be able to wait async actions with fixed defined suffixes

14 lines (13 loc) 475 B
import { Action } from 'redux'; interface DispatchAsyncResultSuccess<T = any> { success: true; result: T; } interface DispatchAsyncResultError { success: false; error: Error; canceled?: true; } export declare type DispatchAsyncResult<T = any> = DispatchAsyncResultSuccess<T> | DispatchAsyncResultError; export declare function dispatchAsync<T = any>(dispatch: (a: Action) => void, action: Action): Promise<DispatchAsyncResult<T>>; export {};