import type { Action as ReduxAction, UnknownAction, Dispatch as ReduxDispatch, Middleware } from 'redux';
import type { ExtractDispatchExtensions } from '@reduxjs/toolkit/dist/tsHelpers';
import type { ReactReduxContextValue } from 'react-redux';
import type { Context } from 'react';
import type { DynamicMiddlewareInstance, GetDispatch, GetState, MiddlewareApiConfig } from '@reduxjs/toolkit/dist/dynamicMiddleware/types';
export type UseDispatchWithMiddlewareHook<Middlewares extends Middleware<any, State, Dispatch>[] = [], State = any, Dispatch extends ReduxDispatch<UnknownAction> = ReduxDispatch<UnknownAction>> = () => ExtractDispatchExtensions<Middlewares> & Dispatch;
export type CreateDispatchWithMiddlewareHook<State = any, Dispatch extends ReduxDispatch<UnknownAction> = ReduxDispatch<UnknownAction>> = {
    <Middlewares extends [
        Middleware<any, State, Dispatch>,
        ...Middleware<any, State, Dispatch>[]
    ]>(...middlewares: Middlewares): UseDispatchWithMiddlewareHook<Middlewares, State, Dispatch>;
    withTypes<MiddlewareConfig extends MiddlewareApiConfig>(): CreateDispatchWithMiddlewareHook<GetState<MiddlewareConfig>, GetDispatch<MiddlewareConfig>>;
};
type ActionFromDispatch<Dispatch extends ReduxDispatch<ReduxAction>> = Dispatch extends ReduxDispatch<infer Action> ? Action : never;
interface ReactDynamicMiddlewareInstance<State = any, Dispatch extends ReduxDispatch<UnknownAction> = ReduxDispatch<UnknownAction>> extends DynamicMiddlewareInstance<State, Dispatch> {
    createDispatchWithMiddlewareHookFactory: (context?: Context<ReactReduxContextValue<State, ActionFromDispatch<Dispatch>>>) => CreateDispatchWithMiddlewareHook<State, Dispatch>;
    createDispatchWithMiddlewareHook: CreateDispatchWithMiddlewareHook<State, Dispatch>;
}
export declare const createDynamicMiddleware: <State = any, Dispatch extends ReduxDispatch<UnknownAction> = ReduxDispatch<UnknownAction>>() => ReactDynamicMiddlewareInstance<State, Dispatch>;
export {};
