index.d.ts 624 B

1234567891011121314151617181920
  1. import { Middleware, Action, AnyAction } from "redux";
  2. export interface ThunkDispatch<S, E, A extends Action> {
  3. <T extends A>(action: T): T;
  4. <R>(asyncAction: ThunkAction<R, S, E, A>): R;
  5. }
  6. export type ThunkAction<R, S, E, A extends Action> = (
  7. dispatch: ThunkDispatch<S, E, A>,
  8. getState: () => S,
  9. extraArgument: E
  10. ) => R;
  11. export type ThunkMiddleware<S = {}, A extends Action = AnyAction, E = undefined> = Middleware<ThunkDispatch<S, E, A>, S, ThunkDispatch<S, E, A>>;
  12. declare const thunk: ThunkMiddleware & {
  13. withExtraArgument<E>(extraArgument: E): ThunkMiddleware<{}, AnyAction, E>
  14. }
  15. export default thunk;