Skip to content

Commit ed83214

Browse files
committed
Adjust mergeDeep() types
1 parent e107108 commit ed83214

File tree

3 files changed

+17
-16
lines changed

3 files changed

+17
-16
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@
154154
"ts-morph": "^25.0.1",
155155
"ts-node": "^10.9.1",
156156
"ts-patch": "^3.0.2",
157-
"type-fest": "^5.0.1",
157+
"type-fest": "^5.4.4",
158158
"typescript": "~5.9.3",
159159
"typescript-transform-paths": "^3.4.6"
160160
},

src/common/functions/merge-deep.ts

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
import { isPlainObject, mapValues } from '@seedcompany/common';
2-
import type { Merge } from 'type-fest';
2+
import type { MergeDeep } from 'type-fest';
33

44
/**
55
* This merges _plain_ objects deeply, everything else is replaced.
66
*/
77
export const mergeDeep = <A extends object, B extends object>(
88
a: A,
99
b: B,
10-
): Merge<A, B> => ({
11-
...a,
12-
...(mapValues(b, (key, bVal) => {
13-
const aVal = a[key];
14-
return isPlainObject(aVal) && isPlainObject(bVal)
15-
? mergeDeep(aVal, bVal)
16-
: bVal;
17-
}).asRecord as B),
18-
});
10+
): MergeDeep<A, B> =>
11+
({
12+
...a,
13+
...mapValues(b, (key, bVal) => {
14+
const aVal = a[key];
15+
return isPlainObject(aVal) && isPlainObject(bVal)
16+
? mergeDeep(aVal, bVal)
17+
: bVal;
18+
}).asRecord,
19+
}) as any;

yarn.lock

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6791,7 +6791,7 @@ __metadata:
67916791
ts-morph: "npm:^25.0.1"
67926792
ts-node: "npm:^10.9.1"
67936793
ts-patch: "npm:^3.0.2"
6794-
type-fest: "npm:^5.0.1"
6794+
type-fest: "npm:^5.4.4"
67956795
typescript: "npm:~5.9.3"
67966796
typescript-transform-paths: "npm:^3.4.6"
67976797
urlpattern-polyfill: "npm:^10.0.0"
@@ -14633,12 +14633,12 @@ __metadata:
1463314633
languageName: node
1463414634
linkType: hard
1463514635

14636-
"type-fest@npm:^5.0.1":
14637-
version: 5.0.1
14638-
resolution: "type-fest@npm:5.0.1"
14636+
"type-fest@npm:^5.0.1, type-fest@npm:^5.4.4":
14637+
version: 5.4.4
14638+
resolution: "type-fest@npm:5.4.4"
1463914639
dependencies:
1464014640
tagged-tag: "npm:^1.0.0"
14641-
checksum: 10c0/8d248edd9705e0da3cc14f4f4ca7fb40a6c5b2c822fe4ba8fc226743578bc229f66fa4ff66e7d4070806ab8312adc64199ce0f0836d20ede13922ced2ff36118
14641+
checksum: 10c0/bf9c6d7df5383fd720aac71da8ce8690ff1c554459d19cf3c72d61eac98255dba57abe20c628f91f4116f66211791462fdafa90b2be2d7405a5a4c295e4d849d
1464214642
languageName: node
1464314643
linkType: hard
1464414644

0 commit comments

Comments
 (0)