/** * @file Utilities for defining typed action creators and reducer handler maps without external dependencies. */ export type AnyAction = { type: string; }; export type AnyActionCreator = { (...args: any[]): AnyAction; readonly type: string; }; type PayloadCreator = (...args: any[]) => any; type ActionFromPayload = ReturnType extends undefined | void ? { type: Type; } : { type: Type; payload: Exclude, undefined>; }; /** * Creates a typed action creator with an attached literal `type` property. */ export declare function createAction(type: Type): (() => { type: Type; }) & { readonly type: Type; }; export declare function createAction(type: Type, payloadCreator: Creator): ((...args: Parameters) => ActionFromPayload) & { readonly type: Type; }; export type ActionCreatorsMap = Record; export type ActionUnion = ReturnType; export type CaseReducer = (state: State, action: Action, extra: Extra) => State; export type BoundActionCreators = { [Key in keyof Creators]: (...args: Parameters) => ReturnType; }; export declare const bindActionCreators: (creators: Creators, dispatch: (action: ActionUnion) => unknown) => BoundActionCreators; export declare const createActionHandlerMap: (creators: Creators, handlers: { [Key in keyof Creators]?: CaseReducer, Extra>; }) => Record, Extra>>; export {};