type Dict = Record; type Mutation = ( payload: unknown, action: Record ) => (state: TState) => TState; type ActionGenerator = { type: string } & ((...args: any[]) => { type: string; payload?: unknown; }); declare module 'updux' { /** * Configuration object typically passed to the constructor of the class Updux. */ export interface UpduxConfig { /** * Local initial state. * @default {} */ initial?: TState; /** * Subduxes to be merged to this dux. */ subduxes?: Dict; /** * Local actions. */ actions?: Record; /** * Local selectors. */ selectors?: Record; /** * Local mutations */ mutations?: Record; /** * Selectors to apply to the mapped subduxes. Only * applicable if the dux is a mapping dux. */ mappedSelectors?: Record; /** * Local effects. */ effects?: Record; /** * Local reactions. */ reactions?: Record; /** * If true, enables mapped reactions. Additionally, it can be * a reaction function, which will treated as a regular * reaction for the mapped dux. */ mappedReaction?: Function | boolean; } export class Updux { constructor(config: Partial>); get initial(): TState; get selectors(): unknown; /** * Sets the local mutation for the given action. * * The action can be specified via its type * or its generator. * * Returns the same mutation function. */ setMutation( actionType: string, mutation: TMutation ): TMutation; setMutation( action: ActionGenerator, mutation: TMutation ): TMutation; /** * Registers the action for the dux. * If no payload function is provided, whatever is * given as an argument to the action generator will * be set as-is in the action's payload. */ setAction(actionType: string, payloadFunc?: Function); } }