UNPKG

@data-client/core

Version:

Async State Management without the Management. REST, GraphQL, SSE, Websockets, Fetch

14 lines (13 loc) 921 B
import Controller from '../controller/Controller.js'; import { Manager } from '../types.js'; export default function applyManager(managers: Manager[], controller: Controller): ReduxMiddleware[]; export interface ReduxMiddlewareAPI<R extends Reducer<any, any> = Reducer<any, any>> { getState: () => ReducerState<R>; dispatch: ReactDispatch<R>; } export type ReduxMiddleware = <R extends Reducer<any, any>>({ dispatch, }: ReduxMiddlewareAPI<R>) => (next: ReactDispatch<R>) => ReactDispatch<R>; export type ReactDispatch<R extends Reducer<any, any>> = (action: ReducerAction<R>) => Promise<void>; export type Reducer<S, A> = (prevState: S, action: A) => S; export type ReducerState<R extends Reducer<any, any>> = R extends Reducer<infer S, any> ? S : never; export type ReducerAction<R extends Reducer<any, any>> = R extends Reducer<any, infer A> ? A : never; //# sourceMappingURL=applyManager.d.ts.map