Skip to content

Commit

Permalink
Add ArrayMergeOptions interface
Browse files Browse the repository at this point in the history
Since the `cloneUnlessOtherwiseSpecified` function wasn't part of the `Options` interface, it couldn't be called in a TypeScript project even though it is passed to the `arrayMerge` callback on its `options` object.
  • Loading branch information
raddevon authored Oct 26, 2021
1 parent 7640d50 commit ebb06e6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,15 @@ declare function deepmerge<T1, T2>(x: Partial<T1>, y: Partial<T2>, options?: dee

declare namespace deepmerge {
export interface Options {
arrayMerge?(target: any[], source: any[], options?: Options): any[];
arrayMerge?(target: any[], source: any[], options?: ArrayMergeOptions): any[];
clone?: boolean;
customMerge?: (key: string, options?: Options) => ((x: any, y: any) => any) | undefined;
isMergeableObject?(value: object): boolean;
}
export interface ArrayMergeOptions {
isMergeableObject(value: object): boolean;
cloneUnlessOtherwiseSpecified(value: object, options?: Options): object;
}

export function all (objects: object[], options?: Options): object;
export function all<T> (objects: Partial<T>[], options?: Options): T;
Expand Down

0 comments on commit ebb06e6

Please sign in to comment.