UNPKG

@lumieslab/stasho

Version:

lightweight state management library

11 lines (10 loc) 1.47 kB
import { Action, EffectCallback, MemoryCallback, ReducerCallback, ActionCallbackWithParams, ActionCallbackWithoutParams, ActionCallbackContext } from "./interfaces/store-interfaces"; export declare function buildMemory<T extends MemoryCallback<any, any>[]>(...callbacks: [...T]): (input: Parameters<T[0]>[0]) => T[number]; export declare function buildReducer<T extends ReducerCallback<any, any>[]>(...callbacks: [...T]): (previousState: Parameters<T[0]>[0], action: Parameters<T[0]>[1]) => ReturnType<T[number]>; export declare function buildEffect<T extends EffectCallback<any>[]>(...callbacks: [...T]): (action: Parameters<T[0]>[0]) => void; export declare function isAction(actionA: string | Action | ActionCallbackContext, actionB: string | Action | ActionCallbackContext): boolean; export declare function actionWithParams<T extends object>(type: string): ActionCallbackWithParams<T>; export declare function actionWithoutParams(type: string): ActionCallbackWithoutParams; export declare function filteredReducer<S, A extends Action>(whitelist: ((() => any) | ((value: any) => any))[], callback: (state: S, action: A) => S): (state: S, action: A) => S; export declare function subReducer<S, V extends keyof S, A extends Action>(slice: V, callback: (state: S[V], action: A) => S[V]): (state: S, action: A) => S; export declare function combinedReducers<S>(...callbacks: ((state: S, action: Action & any) => S)[]): (startingState: S, action: Action & any) => S;