import type { DeepPath, FnO, OptPathVal, Path, Path0, Path1, Path2, Path3, Path4, Path5, Path6, Path7, Path8, PathVal } from "@thi.ng/api"; import type { UpdateFn } from "./api.js"; /** * Similar to {@link defSetterUnsafe}, returns a function to update * values at given `path` using provided update `fn`. Paths and the * arguments given to the returned function are NOT type checked. * * @remarks * The returned function accepts a single object / array and applies * `fn` to given path value (incl. any additional / optional arguments * passed) and uses result as new value. Does not modify original state. * * The type parameter `T` can be used to indicate the type of the nested * value to be updated (default: `any`). * * @example * ```ts tangle:../export/def-update-unsafe.ts * import { defUpdaterUnsafe } from "@thi.ng/paths"; * * const incB = defUpdaterUnsafe("a.b", (x, n) => x + n); * // or * // const incB = defUpdaterUnsafe(["a", "b"], (x, n) => x + n); * * console.log( * incB({ a: { b: 10 } }, 13) * ); * // { a: { b: 23 } } * ``` * * @param path - * @param fn - */ export declare const defUpdaterUnsafe: (path: Path, fn: UpdateFn) => FnO; /** * Type checked version of {@link defUpdaterUnsafe}. Only the first 8 * path levels are type checked. * * @param path - * @param fn - */ export declare function defUpdater(path: Path0, fn: UpdateFn): FnO; export declare function defUpdater(path: Path1, fn: UpdateFn, PathVal>): FnO; export declare function defUpdater(path: Path2, fn: UpdateFn, PathVal>): FnO; export declare function defUpdater(path: Path3, fn: UpdateFn, PathVal>): FnO; export declare function defUpdater(path: Path4, fn: UpdateFn, PathVal>): FnO; export declare function defUpdater(path: Path5, fn: UpdateFn, PathVal>): FnO; export declare function defUpdater(path: Path6, fn: UpdateFn, PathVal>): FnO; export declare function defUpdater(path: Path7, fn: UpdateFn, PathVal>): FnO; export declare function defUpdater(path: Path8, fn: UpdateFn, PathVal>): FnO; export declare function defUpdater(path: DeepPath, fn: UpdateFn): FnO; //# sourceMappingURL=updater.d.ts.map