@buurman/commons
Version:
The buurman commons package is a utility belt
12 lines • 746 B
TypeScript
import { Reducer } from "../types";
export interface Mutation<TPayload = any> {
type: string;
payload?: TPayload;
}
export declare type MutationReducer<TValue> = Reducer<TValue, Mutation>;
export declare type MapArgsToPayload<TPayload> = (...args: any[]) => TPayload;
export declare const createMutatorApi: <TReturnValue, TValue>(returnValue: () => TReturnValue, reducer: Reducer<TValue, Mutation<any>>) => {
createMutator: <TPayload, TMapArgsToPayload extends MapArgsToPayload<TPayload> = MapArgsToPayload<TPayload>>(type: string, mapArgsToPayload?: TMapArgsToPayload) => (...args: Parameters<TMapArgsToPayload>) => TReturnValue;
applyMutations: (initialValue: TValue) => TValue;
};
//# sourceMappingURL=index.d.ts.map