import { Middleware } from 'redux'; import { Action } from '../Actions'; import { EpicDependencies } from '../Core/Store'; export declare type ActionCreatorServices = EpicDependencies; export declare type ActionCreatorResult = T | ActionThunk | ActionCreatorResultArray | ActionCreatorResultPromise; interface ActionCreatorResultArray extends Array> { } interface ActionCreatorResultPromise extends Promise> { } export interface ActionThunk { (services: S): ActionCreatorResult; } export declare const emptyType: unique symbol; export declare type EmptyAction = { type: typeof emptyType; }; export declare const emptyAction: EmptyAction; /** * The DispatchAction type describes the type of function that is used to * dispatch actions. */ export declare type DispatchAction = (action: ActionCreatorResult) => ActionCreatorResult; declare type WdkMiddleWare = Middleware>; /** * Create a function that takes a channel and creates a dispatch function * `dispatchAction` that forwards calls to `dispatcher.dispatch` using the * channel as a scope for the audience of the action. * * In `dispatchAction`: * * If `action` is a function (i.e., a thunk), it will be called with `services`. * The return type of the function is the recursive type * `ActionCreatorResult`, where `T` is the type of Action the function may * produce. `dispatchAction` will recursively unwrap the various types until an * action object is encountered, which will then be dispatched to the * `dispatcher`. If no action should be dispatched, use the special * `emptyAction` value. * * This design enforces that a value is always returned which makes error * handling more reliable. * * Note: In a previous design, the thunk was also passed the main dispatch * action and was expected to return void. This design encouraged promise * rejections to go unhandled, which made comprehensive error handling more * difficult. */ export declare const wdkMiddleware: (services: S) => WdkMiddleWare; export declare const logger: WdkMiddleWare; declare module 'redux' { interface Dispatch { (action: ActionCreatorResult): ActionCreatorResult; } } export {}; //# sourceMappingURL=WdkMiddleware.d.ts.map