@kakasoo/deep-strict-types 1.0.28 → 1.0.29
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/bin/src/index.d.ts +1 -0
- package/bin/src/index.d.ts.map +1 -1
- package/bin/src/index.js +1 -0
- package/bin/src/index.js.map +1 -1
- package/bin/src/types/DeepStrictMerge.d.ts +31 -0
- package/bin/src/types/DeepStrictMerge.d.ts.map +1 -0
- package/bin/src/types/DeepStrictMerge.js +3 -0
- package/bin/src/types/DeepStrictMerge.js.map +1 -0
- package/package.json +1 -1
package/bin/src/index.d.ts
CHANGED
package/bin/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,0BAA0B,CAAC;AACzC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,kCAAkC,CAAC;AACjD,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,mBAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AACxC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,kCAAkC,CAAC;AACjD,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,mBAAmB,CAAC"}
|
package/bin/src/index.js
CHANGED
|
@@ -16,6 +16,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./DeepStrictAssert"), exports);
|
|
18
18
|
__exportStar(require("./types/DeepDateToString"), exports);
|
|
19
|
+
__exportStar(require("./types/DeepStrictMerge"), exports);
|
|
19
20
|
__exportStar(require("./types/DeepStrictObjectKeys"), exports);
|
|
20
21
|
__exportStar(require("./types/DeepStrictObjectLastKeys"), exports);
|
|
21
22
|
__exportStar(require("./types/DeepStrictOmit"), exports);
|
package/bin/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAAmC;AACnC,2DAAyC;AACzC,+DAA6C;AAC7C,mEAAiD;AACjD,yDAAuC;AACvC,yDAAuC;AACvC,4DAA0C;AAC1C,oDAAkC;AAClC,gDAA8B;AAC9B,oDAAkC;AAClC,kDAAgC;AAChC,gDAA8B;AAC9B,kDAAgC;AAChC,yDAAuC;AACvC,4DAA0C;AAC1C,6DAA2C;AAC3C,6DAA2C;AAC3C,oDAAkC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAAmC;AACnC,2DAAyC;AACzC,0DAAwC;AACxC,+DAA6C;AAC7C,mEAAiD;AACjD,yDAAuC;AACvC,yDAAuC;AACvC,4DAA0C;AAC1C,oDAAkC;AAClC,gDAA8B;AAC9B,oDAAkC;AAClC,kDAAgC;AAChC,gDAA8B;AAC9B,kDAAgC;AAChC,yDAAuC;AACvC,4DAA0C;AAC1C,6DAA2C;AAC3C,6DAA2C;AAC3C,oDAAkC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
declare namespace DeepStrictMerge {
|
|
2
|
+
/**
|
|
3
|
+
* @title Infer Type
|
|
4
|
+
*
|
|
5
|
+
* A helper type that recursively merges two object types, `Target` and `Source`, at the deepest level.
|
|
6
|
+
* This type is used internally to handle merging the properties of `Target` and `Source`.
|
|
7
|
+
*
|
|
8
|
+
* - If both `Target` and `Source` share a common key, their corresponding values are merged.
|
|
9
|
+
* - If the values are objects, they are merged recursively.
|
|
10
|
+
* - If the values are arrays, their elements are merged.
|
|
11
|
+
* - If an element of the array is not an object, merging is not possible.
|
|
12
|
+
*/
|
|
13
|
+
type Infer<Target extends object, Source extends object> = {
|
|
14
|
+
[key in keyof Target | keyof Source]: key extends keyof Target ? key extends keyof Source ? Target[key] extends object ? Source[key] extends object ? Target[key] extends Array<infer TE extends object> ? Source[key] extends Array<infer PE extends object> ? Array<Infer<TE, PE>> : never : Infer<Target[key], Source[key]> : Target[key] : Target[key] : Target[key] : key extends keyof Source ? key extends keyof Target ? Source[key] extends object ? Target[key] extends object ? Target[key] extends Array<infer TE extends object> ? Source[key] extends Array<infer PE extends object> ? Array<Infer<TE, PE>> : never : Infer<Target[key], Source[key]> : Source[key] : Source[key] : Source[key] : never;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* @title DeepStrictMerge Type
|
|
19
|
+
*
|
|
20
|
+
* A type that deeply merges two object types, `Target` and `Source`.
|
|
21
|
+
* Nested objects are recursively merged, and in the case of array types, the elements of the arrays are merged into a new type.
|
|
22
|
+
*
|
|
23
|
+
* Merge Rules:
|
|
24
|
+
* 1. For object types, if both `Target` and `Source` have a common key, the value from `Target` takes precedence, and `Source` does not overwrite it.
|
|
25
|
+
* 2. For array types, if both `Target` and `Source` are arrays and their elements are objects, those elements are merged.
|
|
26
|
+
* - If the elements of the arrays are not objects, merging is not possible.
|
|
27
|
+
* 3. If only one of the types is an array, merging is not possible.
|
|
28
|
+
*/
|
|
29
|
+
export type DeepStrictMerge<Target extends object, Source extends object> = Target extends Array<infer TE extends object> ? Source extends Array<infer PE extends object> ? DeepStrictMerge.Infer<TE, PE>[] : never : DeepStrictMerge.Infer<Target, Source>;
|
|
30
|
+
export {};
|
|
31
|
+
//# sourceMappingURL=DeepStrictMerge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DeepStrictMerge.d.ts","sourceRoot":"","sources":["../../../src/types/DeepStrictMerge.ts"],"names":[],"mappings":"AAAA,kBAAU,eAAe,CAAC;IACxB;;;;;;;;;;OAUG;IACH,KAAY,KAAK,CAAC,MAAM,SAAS,MAAM,EAAE,MAAM,SAAS,MAAM,IAAI;SAE/D,GAAG,IAAI,MAAM,MAAM,GAAG,MAAM,MAAM,GAAG,GAAG,SAAS,MAAM,MAAM,GAC1D,GAAG,SAAS,MAAM,MAAM,GACtB,MAAM,CAAC,GAAG,CAAC,SAAS,MAAM,GACxB,MAAM,CAAC,GAAG,CAAC,SAAS,MAAM,GACxB,MAAM,CAAC,GAAG,CAAC,SAAS,KAAK,CAAC,MAAM,EAAE,SAAS,MAAM,CAAC,GAChD,MAAM,CAAC,GAAG,CAAC,SAAS,KAAK,CAAC,MAAM,EAAE,SAAS,MAAM,CAAC,GAChD,KAAK,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,GACpB,KAAK,GACP,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,GACjC,MAAM,CAAC,GA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