import type { AnyObject } from '@xylabs/object-model';
/**
* Deeply merges two types into a new type.
*/
type DeepMerge = {
[K in keyof A | keyof B]: K extends keyof B ? K extends keyof A ? A[K] extends object ? B[K] extends object ? DeepMerge : B[K] : B[K] : B[K] : K extends keyof A ? A[K] : never;
};
/**
* Merges multiple types into a new type.
*/
type MergeAll = T extends [infer First extends object, ...infer Rest extends object[]] ? MergeAll> : R;
/**
* Options for merging objects in the deep merge function.
*/
interface MergeOptions {
/**
* Strategy for merging arrays.
* - 'overwrite': Overwrites the array with the last object's value.
* - 'concat': Concatenates arrays from all objects.
* @default 'overwrite'
*/
arrayStrategy?: 'overwrite' | 'concat';
/**
* Mutate the first object in the list instead of creating a new one.
* @default false
*/
mutate?: boolean;
}
/**
* Creates a deep merge function with the specified options.
* @param options Options for merging.
* @returns A deep merge function configured for the specified options.
*/
export declare function createDeepMerge(options: MergeOptions): (...objects: T) => MergeAll;
/**
* Deeply merges multiple objects into a new object.
* @param objects Multiple objects to merge deeply.
* The function merges properties from all objects into a new object.
* If a property exists in multiple objects, the last object's value will be used.
* If a property is an object, it will be merged recursively.
* If a property is an array, it will be overwritten by the last object's value.
* If a property is a primitive value, it will be overwritten by the last object's value.
* If a property is undefined in the source, it will be skipped.
* If a property is a symbol, it will be merged as well.
* @returns A new object with the merged properties.
*/
export declare const deepMerge: (...objects: T) => MergeAll;
export {};
//# sourceMappingURL=deepMerge.d.ts.map