//#region src/object/assign-defaults.d.ts type IntersectAll = Sources extends readonly [infer Head, ...infer Tail] ? Head & IntersectAll : unknown; interface AssignDefaultsOptions { /** * When `true`, recurses into nested objects so missing keys are filled at * every depth (delegates to `defaultsDeep`). When `false` (the default), * only top-level keys are filled (delegates to `defaults`). */ deep?: boolean; /** * When `true`, the target is left untouched and a new object is returned. * When `false` (the default), the target is mutated in place. */ copy?: boolean; } /** * Fills in the keys of `target` that are `undefined` (or inherited from * `Object.prototype`) using the given `source` — or an array of `sources` * applied left to right, where the first defined value for a key wins. Keys * already present and defined on `target` are never overwritten. * * By default the `target` is **mutated** in place (delegates to `defaults`). * Pass `{deep: true}` to fill missing keys recursively (delegates to * `defaultsDeep`). Pass `{copy: true}` to leave the `target` untouched and get * a new object back (delegates to `toDefaulted`); the two options compose. * @param target - The object receiving defaults. Mutated unless `{copy: true}` is set. * @param source - A single defaults object, or an array of them applied left to right. * @param options - Optional behavior flags. * @param options.deep When `true`, fills missing keys recursively. * @param options.copy When `true`, returns a new object instead of mutating `target`. * @returns The defaulted object — the mutated `target`, or a new object when `{copy: true}`. * @example * // Fill missing top-level keys (mutating, the default) * assignDefaults({a: 1}, {a: 9, b: 2}); * // {a: 1, b: 2} * @example * // Multiple sources — earlier sources win * assignDefaults({a: 1}, [{b: 2}, {b: 9, c: 3}]); * // {a: 1, b: 2, c: 3} * @example * // Recursive fill with `{deep: true}` * assignDefaults({a: {x: 1}}, {a: {x: 9, y: 2}}, {deep: true}); * // {a: {x: 1, y: 2}} * @example * // Immutable with `{copy: true}` * const config = {a: 1}; * const result = assignDefaults(config, {b: 2}, {copy: true}); * // result is {a: 1, b: 2}; config is still {a: 1} */ declare function assignDefaults(target: T, source: Sources, options?: AssignDefaultsOptions): NonNullable>; declare function assignDefaults(target: T, source: S, options?: AssignDefaultsOptions): NonNullable; //#endregion export { assignDefaults };