/** Performs a shallow update of an object using a partial object of the same shape. A new object is returned. */ export declare function update(host: Obj, spec: Pick): Obj; /** Marker used to delete a key */ export declare const DELETE: undefined; export declare type Leaf = string | number | boolean | null | symbol | Date | Function; export declare type OptionContent> = Exclude, undefined>; export declare type Updater = [CURRENT] extends [OptionLike] ? ObjectUpdater | undefined> : [CURRENT] extends [any[]] ? ArrayUpdater : [CURRENT] extends [Leaf] ? AnySetter : ObjectUpdater; export interface ArrayUpdater extends AnyUpdater { /** * Selects an Array index for update or further at() chaining */ at(index: number): Updater; } export declare type ObjectUpdater = AnyUpdater & { /** * Selects this Object key for update or further at() chaining */ at(key: K): Updater; } & (undefined extends CURRENT ? AnyDeleter : {}); export interface AnySetter { /** * Sets the value at the currently selected path. */ set(value: CURRENT): TARGET; /** * Modifies the value at the specified path. The current value is passed. */ modify(modifier: (value: CURRENT) => CURRENT): TARGET; } export interface AnyDeleter { /** * Deletes the key or index at the specified path. */ delete(): TARGET; } export interface AnyUpdater extends AnySetter { /** * Makes the previous nullable chain level 'safe' by using a default value */ withDefault(defaultValue: CURRENT): Updater>; /** * Aborts the whole update operation if the previous chain level is null or undefined. */ abortIfUndef(): Updater>; /** * Aborts the whole update operation if the previous chain level doesn't verify a type guard */ abortIfNot(predicate: (value: CURRENT) => value is B): Updater; /** * Aborts the whole update operation if the previous chain level doesn't verify a predicate */ abortIfNot(predicate: (value: CURRENT) => boolean): Updater; } /** * Meant to match space-lift/option, but without requiring a hard (cyclic) dependency. */ interface OptionLike { get(): A | undefined; map(fn: (a: A) => B | null | undefined): OptionLike; } export declare function deepUpdate(target: TARGET): Updater; export {};