UNPKG

redux-thunk-error-handler

Version:

An error handler for thunks that, when used in conjunction with `redux-thunk-recursion-detect` can handle errors thrown in both async and sync thunks gracefully.

23 lines (19 loc) 832 B
import { Action, Middleware, AnyAction } from 'redux'; import { ThunkAction, ThunkDispatch } from 'redux-thunk-recursion-detect'; declare function createThunkErrorCatchMiddleware< TState = {}, TExtraThunkArg = undefined, TBasicAction extends Action = AnyAction, >(config: { onError(error: unknown): TBasicAction | ThunkAction<unknown, TState, TExtraThunkArg, TBasicAction> | void }): Middleware< {}, TState, ThunkDispatch<TState, TExtraThunkArg, TBasicAction> >; export declare function forceHandleError< TReturnType, TState, TExtraThunkArg, TBasicAction extends Action, >(thunkFn: ThunkAction<TReturnType, TState, TExtraThunkArg, TBasicAction>): ThunkAction<TReturnType, TState, TExtraThunkArg, TBasicAction>; export declare const handleErrorsSymbol: symbol; export default createThunkErrorCatchMiddleware;