deepie-merge 3.0.1 → 3.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.d.ts +6 -2
  2. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -8,9 +8,13 @@ type DeepieMergeOpts<T = any> = {
8
8
  type DeepMergeable = {
9
9
  [key: string]: any;
10
10
  } | Array<any>;
11
- type DeepPartial<T> = T extends Array<infer U> ? Array<DeepPartial<U>> : T extends object ? { [K in keyof T]?: DeepPartial<T[K]> } : T;
11
+ /** Same top-level shape as `T` (array vs object) with the same keys, but with
12
+ * values widened to `unknown`. Catches array/object mismatches and top-level
13
+ * excess keys on fresh literals, while accepting wider override types
14
+ * (e.g. `Partial<UserConfig>` against a `satisfies`-narrowed literal). */
15
+ type DeepMergeSource<T> = T extends ReadonlyArray<any> ? ReadonlyArray<unknown> : T extends object ? { [K in keyof T]?: unknown } : never;
12
16
  /** deep-merge b into a */
13
- declare function deepMerge<T extends DeepMergeable>(a: T, b: NoInfer<T> | DeepPartial<NoInfer<T>> | null | undefined, {
17
+ declare function deepMerge<T extends DeepMergeable>(a: T, b: NoInfer<T> | DeepMergeSource<NoInfer<T>> | null | undefined, {
14
18
  arrayExtend,
15
19
  maxRecursion,
16
20
  clone
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "deepie-merge",
3
- "version": "3.0.1",
3
+ "version": "3.0.2",
4
4
  "description": "Yay, another deep merge",
5
5
  "author": "silverwind <me@silverwind.io>",
6
6
  "repository": "silverwind/deepie-merge",