import { LeafStandardAction } from "./action.type"; import { LeafStandardActionCreator } from "./creator.type"; import LeafReducer from "./reducer.type"; declare namespace DefaultCreators { /** * The default assign action creator * * @template E - Source object shape */ type Assign = (...sources: E[]) => LeafStandardAction; type Clear = (toNull?: boolean) => LeafStandardAction; type Concat = LS extends string ? (string: string) => LeafStandardAction : LS extends any[] | [] ? (arr: LS) => LeafStandardAction : (arrayOrString: any[] | string) => LeafStandardAction; type Do = (callback: (leafState: LS, treeState: TS) => LS) => LeafStandardAction<(leafState: LS, treeState: TS) => LS>; type Drop = (n?: number) => LeafStandardAction; type Filter = (callback: (element: T, index: number, array: T[]) => T[]) => LeafStandardAction<(element: T, index: number, array: T[]) => T[]>; type Increment = (n?: number) => LeafStandardAction; type Off = () => LeafStandardAction; type On = () => LeafStandardAction; type Path = (path: (string | number)[], value: LS) => LeafStandardAction<{ path: (string | number)[]; value: LS; }>; type Push = (element: E, index?: number, replace?: boolean) => LeafStandardAction<{ element: E; index?: number; replace?: boolean; }>; type PushedSet = (value: E) => LeafStandardAction; type Reset = () => LeafStandardAction; type Set = (key: string, value: LS) => LeafStandardAction<{ path: [string]; value: LS; }>; type Toggle = () => LeafStandardAction; type Update = (newVal: LS) => LeafStandardAction; } export interface LeafCreatorDefaults { assign: DefaultCreators.Assign ? E : any>; clear: DefaultCreators.Clear; concat: DefaultCreators.Concat; do: DefaultCreators.Do; drop: DefaultCreators.Drop; filter: DefaultCreators.Filter ? E : any>; increment: DefaultCreators.Increment; off: DefaultCreators.Off; on: DefaultCreators.On; path: DefaultCreators.Path; push: DefaultCreators.Push ? E : any>; pushedSet: DefaultCreators.PushedSet ? E : any>; reset: DefaultCreators.Reset; set: DefaultCreators.Set; toggle: DefaultCreators.Toggle; update: DefaultCreators.Update; } /** * @template LRD - LeafReducer.Definition of LeafReducer.Schemas */ export declare type LeafCreatorCustoms = LRD extends LeafReducer.Definitions ? { [K in keyof Schemas]: Schemas[K] extends LeafReducer.Schema ? LeafStandardActionCreator : LeafStandardActionCreator; } : LeafStandardActionCreator; export {};