@sladg/apex-state 3.7.1 → 3.7.3

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.
package/dist/index.d.ts CHANGED
@@ -602,10 +602,16 @@ type ComputationPair<DATA extends object, Depth extends number = DefaultDepth> =
602
602
  type DeepRequired<T> = {
603
603
  [K in keyof T]-?: NonNullable<T[K]> extends object ? DeepRequired<NonNullable<T[K]>> : NonNullable<T[K]>;
604
604
  };
605
- /** Recursively makes all properties optional (allows undefined values) */
606
- type DeepPartial<T> = {
607
- [K in keyof T]?: NonNullable<T[K]> extends object ? DeepPartial<NonNullable<T[K]>> | undefined : T[K] | undefined;
608
- };
605
+ /**
606
+ * Recursively makes all properties optional (allows undefined values).
607
+ *
608
+ * Written as a conditional type so TypeScript distributes it over union members
609
+ * automatically — null/undefined fall through to `: T` and are preserved as-is.
610
+ * Array check comes before object so arrays are not mapped over their keys.
611
+ */
612
+ type DeepPartial<T> = T extends (infer U)[] ? DeepPartial<U>[] : T extends readonly (infer U)[] ? readonly DeepPartial<U>[] : T extends object ? {
613
+ [K in keyof T]?: DeepPartial<T[K]>;
614
+ } : T;
609
615
 
610
616
  interface BaseConcernProps<STATE, PATH extends string> {
611
617
  state: STATE;
package/dist/index.js CHANGED
@@ -2433,20 +2433,22 @@ var deepClone = (value) => {
2433
2433
  var deepMerge = (target, source) => {
2434
2434
  if (!source) return target;
2435
2435
  const result = { ...target };
2436
- for (const key in source) {
2437
- if (!Object.prototype.hasOwnProperty.call(source, key)) continue;
2438
- const sourceValue = source[key];
2439
- const targetValue = target[key];
2436
+ const src = source;
2437
+ for (const key in src) {
2438
+ if (!Object.prototype.hasOwnProperty.call(src, key)) continue;
2439
+ const k = key;
2440
+ const sourceValue = src[k];
2441
+ const targetValue = target[k];
2440
2442
  if (is.undefined(sourceValue)) {
2441
2443
  continue;
2442
2444
  }
2443
2445
  if (is.object(sourceValue) && is.object(targetValue)) {
2444
- result[key] = deepMerge(
2446
+ result[k] = deepMerge(
2445
2447
  targetValue,
2446
2448
  sourceValue
2447
2449
  );
2448
2450
  } else {
2449
- result[key] = sourceValue;
2451
+ result[k] = sourceValue;
2450
2452
  }
2451
2453
  }
2452
2454
  return result;