Skip to content

Commit

Permalink
test: test user function
Browse files Browse the repository at this point in the history
  • Loading branch information
Rebecca Stevens committed Nov 10, 2020
1 parent 937fb97 commit 2794460
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions types/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,3 +105,50 @@ const g = {
deepmerge(f, g);
// $ExpectType { key1: string[]; key2: { key2key1: { key2key1key1: () => string; key2key1key2: boolean; key2key1key3: string[]; }; }; key3: { key3key1: { key3key1key1: string; key3key1key2: boolean; key3key1key3: string[]; }; key3key2: (string | boolean)[]; }; }
deepmerge.all([f, g]);

// $ExpectType { foo: any; baz: any; garply: any; grault: any; }
deepmerge(a, b, {
isMergeableObject: (obj: object) => {
return false;
},
});
// $ExpectType { foo: any; baz: any; garply: any; grault: any; }
deepmerge.all([a, b], {
isMergeableObject: (obj: object) => {
return false;
},
});

const h = {
baz: {
quuz: [5, 6],
},
};

// $ExpectType { foo: string; baz: { quuz: any; }; garply: number; }
deepmerge(a, h, {
arrayMerge: (target: unknown[], source: unknown[]) =>
target.length + source.length,
});
// $ExpectType { foo: string; baz: { quuz: any; }; garply: number; }
deepmerge.all([a, h], {
arrayMerge: (target: unknown[], source: unknown[]) =>
target.length + source.length,
});

// $ExpectType { foo: any; baz: any; garply: any; }
deepmerge(a, h, {
customMerge: (key: string) => {
if (key === 'foo') {
return (target: string, source: string) => target + source;
}
}
});
// $ExpectType { foo: any; baz: any; garply: any; }
deepmerge.all([a, h], {
customMerge: (key: string) => {
if (key === 'foo') {
return (target: string, source: string) => target + source;
}
}
});

0 comments on commit 2794460

Please sign in to comment.