import type Controller from './controller/Controller.js'; import type { ActionTypes, State } from './types.js'; export type Dispatch = (value: Actions) => Promise; export interface MiddlewareAPI extends Controller> {} export interface MiddlewareController extends Controller< Dispatch > {} /** @see https://dataclient.io/docs/api/Manager#middleware */ export type Middleware = < C extends MiddlewareController, >( controller: C, ) => (next: C['dispatch']) => C['dispatch']; export type DataClientReducer = ( prevState: State, action: ActionTypes, ) => State;