@bemedev/typings 0.2.1 → 0.2.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.
- package/lib/constants.cjs +2 -2
- package/lib/constants.cjs.map +1 -1
- package/lib/constants.d.ts +2 -2
- package/lib/constants.js +2 -2
- package/lib/constants.js.map +1 -1
- package/lib/helpers/any.cjs +3 -1
- package/lib/helpers/any.cjs.map +1 -1
- package/lib/helpers/any.d.ts +2 -2
- package/lib/helpers/any.js +3 -1
- package/lib/helpers/any.js.map +1 -1
- package/lib/helpers/array.cjs.map +1 -1
- package/lib/helpers/array.d.ts +2 -2
- package/lib/helpers/array.js.map +1 -1
- package/lib/helpers/index.cjs +7 -1
- package/lib/helpers/index.cjs.map +1 -1
- package/lib/helpers/index.d.ts +3 -1
- package/lib/helpers/index.js +6 -2
- package/lib/helpers/index.js.map +1 -1
- package/lib/helpers/intersection.cjs.map +1 -1
- package/lib/helpers/intersection.d.ts +2 -9
- package/lib/helpers/intersection.js.map +1 -1
- package/lib/helpers/optional.cjs.map +1 -1
- package/lib/helpers/optional.d.ts +2 -2
- package/lib/helpers/optional.js.map +1 -1
- package/lib/helpers/partial.cjs.map +1 -1
- package/lib/helpers/partial.d.ts +2 -2
- package/lib/helpers/partial.js.map +1 -1
- package/lib/helpers/primitive.cjs +25 -0
- package/lib/helpers/primitive.cjs.map +1 -0
- package/lib/helpers/primitive.d.ts +10 -0
- package/lib/helpers/primitive.js +25 -0
- package/lib/helpers/primitive.js.map +1 -0
- package/lib/helpers/primitiveObject.cjs.map +1 -1
- package/lib/helpers/primitiveObject.d.ts +3 -3
- package/lib/helpers/primitiveObject.js.map +1 -1
- package/lib/helpers/readonly.cjs +7 -0
- package/lib/helpers/readonly.cjs.map +1 -0
- package/lib/helpers/readonly.d.ts +2 -0
- package/lib/helpers/readonly.js +6 -0
- package/lib/helpers/readonly.js.map +1 -0
- package/lib/helpers/soa.cjs.map +1 -1
- package/lib/helpers/soa.d.ts +1 -1
- package/lib/helpers/soa.js.map +1 -1
- package/lib/helpers/sv.cjs.map +1 -1
- package/lib/helpers/sv.js.map +1 -1
- package/lib/type.types.d.ts +3 -1
- package/lib/types.d.ts +11 -7
- package/package.json +1 -1
package/lib/constants.cjs
CHANGED
|
@@ -8,14 +8,14 @@ const PRIMITIVES = [
|
|
|
8
8
|
"symbol",
|
|
9
9
|
"undefined",
|
|
10
10
|
"null",
|
|
11
|
-
"unknown",
|
|
12
11
|
"never",
|
|
13
12
|
"primitive"
|
|
14
13
|
];
|
|
15
14
|
const PRIMITIVE_OBJECTS = [
|
|
16
15
|
"date",
|
|
17
16
|
"any",
|
|
18
|
-
"object"
|
|
17
|
+
"object",
|
|
18
|
+
"unknown"
|
|
19
19
|
];
|
|
20
20
|
const OPTIONAL = "$$app-ts => optional$$";
|
|
21
21
|
const CUSTOM = "$$app-ts => custom$$";
|
package/lib/constants.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.cjs","names":[],"sources":["../src/constants.ts"],"sourcesContent":["export const PRIMITIVES = [\n \"string\",\n \"number\",\n \"boolean\",\n \"bigint\",\n \"symbol\",\n \"undefined\",\n \"null\",\n \"
|
|
1
|
+
{"version":3,"file":"constants.cjs","names":[],"sources":["../src/constants.ts"],"sourcesContent":["export const PRIMITIVES = [\n \"string\",\n \"number\",\n \"boolean\",\n \"bigint\",\n \"symbol\",\n \"undefined\",\n \"null\",\n \"never\",\n \"primitive\",\n] as const;\n\nexport const PRIMITIVE_OBJECTS = [\"date\", \"any\", \"object\", \"unknown\"] as const;\nexport const OPTIONAL = \"$$app-ts => optional$$\" as const;\nexport const CUSTOM = \"$$app-ts => custom$$\" as const;\nexport const PARTIAL = \"$$app-ts => partial$$\" as const;\nexport const ARRAY = \"$$app-ts => array$$\" as const;\nexport const SOA = \"$$app-ts => soa$$\" as const;\n"],"mappings":";;AAAA,MAAa,aAAa;CACxB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;AAED,MAAa,oBAAoB;CAAC;CAAQ;CAAO;CAAU;CAAU;AACrE,MAAa,WAAW;AACxB,MAAa,SAAS;AACtB,MAAa,UAAU;AACvB,MAAa,QAAQ;AACrB,MAAa,MAAM"}
|
package/lib/constants.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export declare const PRIMITIVES: readonly ["string", "number", "boolean", "bigint", "symbol", "undefined", "null", "
|
|
2
|
-
export declare const PRIMITIVE_OBJECTS: readonly ["date", "any", "object"];
|
|
1
|
+
export declare const PRIMITIVES: readonly ["string", "number", "boolean", "bigint", "symbol", "undefined", "null", "never", "primitive"];
|
|
2
|
+
export declare const PRIMITIVE_OBJECTS: readonly ["date", "any", "object", "unknown"];
|
|
3
3
|
export declare const OPTIONAL: "$$app-ts => optional$$";
|
|
4
4
|
export declare const CUSTOM: "$$app-ts => custom$$";
|
|
5
5
|
export declare const PARTIAL: "$$app-ts => partial$$";
|
package/lib/constants.js
CHANGED
|
@@ -7,14 +7,14 @@ const PRIMITIVES = [
|
|
|
7
7
|
"symbol",
|
|
8
8
|
"undefined",
|
|
9
9
|
"null",
|
|
10
|
-
"unknown",
|
|
11
10
|
"never",
|
|
12
11
|
"primitive"
|
|
13
12
|
];
|
|
14
13
|
const PRIMITIVE_OBJECTS = [
|
|
15
14
|
"date",
|
|
16
15
|
"any",
|
|
17
|
-
"object"
|
|
16
|
+
"object",
|
|
17
|
+
"unknown"
|
|
18
18
|
];
|
|
19
19
|
const OPTIONAL = "$$app-ts => optional$$";
|
|
20
20
|
const CUSTOM = "$$app-ts => custom$$";
|
package/lib/constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","names":[],"sources":["../src/constants.ts"],"sourcesContent":["export const PRIMITIVES = [\n \"string\",\n \"number\",\n \"boolean\",\n \"bigint\",\n \"symbol\",\n \"undefined\",\n \"null\",\n \"
|
|
1
|
+
{"version":3,"file":"constants.js","names":[],"sources":["../src/constants.ts"],"sourcesContent":["export const PRIMITIVES = [\n \"string\",\n \"number\",\n \"boolean\",\n \"bigint\",\n \"symbol\",\n \"undefined\",\n \"null\",\n \"never\",\n \"primitive\",\n] as const;\n\nexport const PRIMITIVE_OBJECTS = [\"date\", \"any\", \"object\", \"unknown\"] as const;\nexport const OPTIONAL = \"$$app-ts => optional$$\" as const;\nexport const CUSTOM = \"$$app-ts => custom$$\" as const;\nexport const PARTIAL = \"$$app-ts => partial$$\" as const;\nexport const ARRAY = \"$$app-ts => array$$\" as const;\nexport const SOA = \"$$app-ts => soa$$\" as const;\n"],"mappings":";AAAA,MAAa,aAAa;CACxB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;AAED,MAAa,oBAAoB;CAAC;CAAQ;CAAO;CAAU;CAAU;AACrE,MAAa,WAAW;AACxB,MAAa,SAAS;AACtB,MAAa,UAAU;AACvB,MAAa,QAAQ;AACrB,MAAa,MAAM"}
|
package/lib/helpers/any.cjs
CHANGED
package/lib/helpers/any.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"any.cjs","names":[],"sources":["../../src/helpers/any.ts"],"sourcesContent":["import type { ObjectT } from \"../types\";\n\nconst any = <T extends ObjectT = ObjectT>(value?: T)
|
|
1
|
+
{"version":3,"file":"any.cjs","names":[],"sources":["../../src/helpers/any.ts"],"sourcesContent":["import type { NotReadonly, ObjectT } from \"../types\";\n\nconst any = <const T extends ObjectT = ObjectT>(value?: T) => {\n return value as ObjectT extends NotReadonly<T> ? \"any\" : NotReadonly<T>;\n};\n\nexport { any };\n"],"mappings":";;AAEA,MAAM,OAA0C,UAAc;AAC5D,QAAO"}
|
package/lib/helpers/any.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { ObjectT } from "../types";
|
|
2
|
-
declare const any: <T extends ObjectT = ObjectT>(value?: T) => ObjectT extends T ? "any" : T
|
|
1
|
+
import type { NotReadonly, ObjectT } from "../types";
|
|
2
|
+
declare const any: <const T extends ObjectT = ObjectT>(value?: T) => ObjectT extends NotReadonly<T> ? "any" : NotReadonly<T>;
|
|
3
3
|
export { any };
|
package/lib/helpers/any.js
CHANGED
package/lib/helpers/any.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"any.js","names":[],"sources":["../../src/helpers/any.ts"],"sourcesContent":["import type { ObjectT } from \"../types\";\n\nconst any = <T extends ObjectT = ObjectT>(value?: T)
|
|
1
|
+
{"version":3,"file":"any.js","names":[],"sources":["../../src/helpers/any.ts"],"sourcesContent":["import type { NotReadonly, ObjectT } from \"../types\";\n\nconst any = <const T extends ObjectT = ObjectT>(value?: T) => {\n return value as ObjectT extends NotReadonly<T> ? \"any\" : NotReadonly<T>;\n};\n\nexport { any };\n"],"mappings":";AAEA,MAAM,OAA0C,UAAc;AAC5D,QAAO"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"array.cjs","names":["ARRAY"],"sources":["../../src/helpers/array.ts"],"sourcesContent":["import { ARRAY } from \"../constants\";\nimport type { ArrayCustom,
|
|
1
|
+
{"version":3,"file":"array.cjs","names":["ARRAY"],"sources":["../../src/helpers/array.ts"],"sourcesContent":["import { ARRAY } from \"../constants\";\nimport type { ArrayCustom, ObjectT } from \"../types\";\n\nconst array = <T extends ObjectT>(value: T) => {\n type Out = ArrayCustom<T>;\n\n return { [ARRAY]: value } as Out;\n};\n\nexport { array };\n"],"mappings":";;;AAGA,MAAM,SAA4B,UAAa;AAG7C,QAAO,GAAGA,kBAAAA,QAAQ,OAAO"}
|
package/lib/helpers/array.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { ArrayCustom,
|
|
2
|
-
declare const array: <
|
|
1
|
+
import type { ArrayCustom, ObjectT } from "../types";
|
|
2
|
+
declare const array: <T extends ObjectT>(value: T) => ArrayCustom<T>;
|
|
3
3
|
export { array };
|
package/lib/helpers/array.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"array.js","names":[],"sources":["../../src/helpers/array.ts"],"sourcesContent":["import { ARRAY } from \"../constants\";\nimport type { ArrayCustom,
|
|
1
|
+
{"version":3,"file":"array.js","names":[],"sources":["../../src/helpers/array.ts"],"sourcesContent":["import { ARRAY } from \"../constants\";\nimport type { ArrayCustom, ObjectT } from \"../types\";\n\nconst array = <T extends ObjectT>(value: T) => {\n type Out = ArrayCustom<T>;\n\n return { [ARRAY]: value } as Out;\n};\n\nexport { array };\n"],"mappings":";;AAGA,MAAM,SAA4B,UAAa;AAG7C,QAAO,GAAG,QAAQ,OAAO"}
|
package/lib/helpers/index.cjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_runtime = require("../_virtual/_rolldown/runtime.cjs");
|
|
3
|
+
const require_helpers_readonly = require("./readonly.cjs");
|
|
3
4
|
const require_helpers_any = require("./any.cjs");
|
|
4
5
|
const require_helpers_array = require("./array.cjs");
|
|
5
6
|
const require_helpers_custom = require("./custom.cjs");
|
|
@@ -7,12 +8,13 @@ const require_helpers_intersection = require("./intersection.cjs");
|
|
|
7
8
|
const require_helpers_litterals = require("./litterals.cjs");
|
|
8
9
|
const require_helpers_optional = require("./optional.cjs");
|
|
9
10
|
const require_helpers_partial = require("./partial.cjs");
|
|
11
|
+
const require_helpers_primitive = require("./primitive.cjs");
|
|
12
|
+
const require_helpers_primitiveObject = require("./primitiveObject.cjs");
|
|
10
13
|
const require_helpers_record = require("./record.cjs");
|
|
11
14
|
const require_helpers_soa = require("./soa.cjs");
|
|
12
15
|
const require_helpers_sv = require("./sv.cjs");
|
|
13
16
|
const require_helpers_tuple = require("./tuple.cjs");
|
|
14
17
|
const require_helpers_union = require("./union.cjs");
|
|
15
|
-
const require_helpers_primitiveObject = require("./primitiveObject.cjs");
|
|
16
18
|
//#region src/helpers/index.ts
|
|
17
19
|
var helpers_exports = /* @__PURE__ */ require_runtime.__exportAll({
|
|
18
20
|
any: () => require_helpers_any.any,
|
|
@@ -22,7 +24,9 @@ var helpers_exports = /* @__PURE__ */ require_runtime.__exportAll({
|
|
|
22
24
|
litterals: () => require_helpers_litterals.litterals,
|
|
23
25
|
optional: () => require_helpers_optional.optional,
|
|
24
26
|
partial: () => require_helpers_partial.partial,
|
|
27
|
+
primitive: () => require_helpers_primitive.primitive,
|
|
25
28
|
primitiveObject: () => require_helpers_primitiveObject.primitiveObject,
|
|
29
|
+
readonly: () => require_helpers_readonly.readonly,
|
|
26
30
|
record: () => require_helpers_record.record,
|
|
27
31
|
soa: () => require_helpers_soa.soa,
|
|
28
32
|
sv: () => require_helpers_sv.sv,
|
|
@@ -43,7 +47,9 @@ exports.intersection = require_helpers_intersection.intersection;
|
|
|
43
47
|
exports.litterals = require_helpers_litterals.litterals;
|
|
44
48
|
exports.optional = require_helpers_optional.optional;
|
|
45
49
|
exports.partial = require_helpers_partial.partial;
|
|
50
|
+
exports.primitive = require_helpers_primitive.primitive;
|
|
46
51
|
exports.primitiveObject = require_helpers_primitiveObject.primitiveObject;
|
|
52
|
+
exports.readonly = require_helpers_readonly.readonly;
|
|
47
53
|
exports.record = require_helpers_record.record;
|
|
48
54
|
exports.soa = require_helpers_soa.soa;
|
|
49
55
|
exports.sv = require_helpers_sv.sv;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":[],"sources":["../../src/helpers/index.ts"],"sourcesContent":["export * from \"./any\";\nexport * from \"./array\";\nexport * from \"./custom\";\nexport * from \"./intersection\";\nexport * from \"./litterals\";\nexport * from \"./optional\";\nexport * from \"./partial\";\nexport * from \"./
|
|
1
|
+
{"version":3,"file":"index.cjs","names":[],"sources":["../../src/helpers/index.ts"],"sourcesContent":["export * from \"./any\";\nexport * from \"./array\";\nexport * from \"./custom\";\nexport * from \"./intersection\";\nexport * from \"./litterals\";\nexport * from \"./optional\";\nexport * from \"./partial\";\nexport * from \"./primitive\";\nexport * from \"./primitiveObject\";\nexport * from \"./readonly\";\nexport * from \"./record\";\nexport * from \"./soa\";\nexport * from \"./sv\";\nexport * from \"./tuple\";\nexport * from \"./union\";\n"],"mappings":""}
|
package/lib/helpers/index.d.ts
CHANGED
|
@@ -5,9 +5,11 @@ export * from "./intersection";
|
|
|
5
5
|
export * from "./litterals";
|
|
6
6
|
export * from "./optional";
|
|
7
7
|
export * from "./partial";
|
|
8
|
+
export * from "./primitive";
|
|
9
|
+
export * from "./primitiveObject";
|
|
10
|
+
export * from "./readonly";
|
|
8
11
|
export * from "./record";
|
|
9
12
|
export * from "./soa";
|
|
10
13
|
export * from "./sv";
|
|
11
14
|
export * from "./tuple";
|
|
12
15
|
export * from "./union";
|
|
13
|
-
export * from "./primitiveObject";
|
package/lib/helpers/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { __exportAll } from "../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { readonly } from "./readonly.js";
|
|
2
3
|
import { any } from "./any.js";
|
|
3
4
|
import { array } from "./array.js";
|
|
4
5
|
import { custom } from "./custom.js";
|
|
@@ -6,12 +7,13 @@ import { intersection } from "./intersection.js";
|
|
|
6
7
|
import { litterals } from "./litterals.js";
|
|
7
8
|
import { optional } from "./optional.js";
|
|
8
9
|
import { partial } from "./partial.js";
|
|
10
|
+
import { primitive } from "./primitive.js";
|
|
11
|
+
import { primitiveObject } from "./primitiveObject.js";
|
|
9
12
|
import { record } from "./record.js";
|
|
10
13
|
import { soa } from "./soa.js";
|
|
11
14
|
import { sv } from "./sv.js";
|
|
12
15
|
import { tuple } from "./tuple.js";
|
|
13
16
|
import { union } from "./union.js";
|
|
14
|
-
import { primitiveObject } from "./primitiveObject.js";
|
|
15
17
|
//#region src/helpers/index.ts
|
|
16
18
|
var helpers_exports = /* @__PURE__ */ __exportAll({
|
|
17
19
|
any: () => any,
|
|
@@ -21,7 +23,9 @@ var helpers_exports = /* @__PURE__ */ __exportAll({
|
|
|
21
23
|
litterals: () => litterals,
|
|
22
24
|
optional: () => optional,
|
|
23
25
|
partial: () => partial,
|
|
26
|
+
primitive: () => primitive,
|
|
24
27
|
primitiveObject: () => primitiveObject,
|
|
28
|
+
readonly: () => readonly,
|
|
25
29
|
record: () => record,
|
|
26
30
|
soa: () => soa,
|
|
27
31
|
sv: () => sv,
|
|
@@ -29,6 +33,6 @@ var helpers_exports = /* @__PURE__ */ __exportAll({
|
|
|
29
33
|
union: () => union
|
|
30
34
|
});
|
|
31
35
|
//#endregion
|
|
32
|
-
export { any, array, custom, helpers_exports, intersection, litterals, optional, partial, primitiveObject, record, soa, sv, tuple, union };
|
|
36
|
+
export { any, array, custom, helpers_exports, intersection, litterals, optional, partial, primitive, primitiveObject, readonly, record, soa, sv, tuple, union };
|
|
33
37
|
|
|
34
38
|
//# sourceMappingURL=index.js.map
|
package/lib/helpers/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../src/helpers/index.ts"],"sourcesContent":["export * from \"./any\";\nexport * from \"./array\";\nexport * from \"./custom\";\nexport * from \"./intersection\";\nexport * from \"./litterals\";\nexport * from \"./optional\";\nexport * from \"./partial\";\nexport * from \"./
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/helpers/index.ts"],"sourcesContent":["export * from \"./any\";\nexport * from \"./array\";\nexport * from \"./custom\";\nexport * from \"./intersection\";\nexport * from \"./litterals\";\nexport * from \"./optional\";\nexport * from \"./partial\";\nexport * from \"./primitive\";\nexport * from \"./primitiveObject\";\nexport * from \"./readonly\";\nexport * from \"./record\";\nexport * from \"./soa\";\nexport * from \"./sv\";\nexport * from \"./tuple\";\nexport * from \"./union\";\n"],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"intersection.cjs","names":[],"sources":["../../src/helpers/intersection.ts"],"sourcesContent":["import type { ObjectMapS } from \"../types\";\n\
|
|
1
|
+
{"version":3,"file":"intersection.cjs","names":[],"sources":["../../src/helpers/intersection.ts"],"sourcesContent":["import type { IntersectionCustom, NotReadonly, ObjectMapS } from \"../types\";\n\nconst intersection = <\n const T extends [ObjectMapS, ObjectMapS, ...ObjectMapS[]],\n>(\n ...values: T\n) => {\n const out = values.reduce((acc, curr) => {\n Object.entries(curr).forEach(([key, value]) => {\n acc[key] = value;\n });\n return acc;\n }, {} as any);\n\n return out as IntersectionCustom<NotReadonly<T>>;\n};\n\nexport { intersection };\n"],"mappings":";;AAEA,MAAM,gBAGJ,GAAG,WACA;AAQH,QAPY,OAAO,QAAQ,KAAK,SAAS;AACvC,SAAO,QAAQ,KAAK,CAAC,SAAS,CAAC,KAAK,WAAW;AAC7C,OAAI,OAAO;IACX;AACF,SAAO;IACN,EAAE,CAAQ"}
|
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
import type { ObjectMapS } from "../types";
|
|
2
|
-
|
|
3
|
-
infer First extends ObjectMapS,
|
|
4
|
-
...infer Rest extends ObjectMapS[]
|
|
5
|
-
] ? First & IntersectionCustom<Rest> : unknown;
|
|
6
|
-
export type IntersectionCustom<T extends ObjectMapS[]> = _IntersectionCustom<T> extends infer R ? {
|
|
7
|
-
[K in keyof R]: R[K];
|
|
8
|
-
} : never;
|
|
9
|
-
declare const intersection: <T extends [ObjectMapS, ObjectMapS, ...ObjectMapS[]]>(...values: T) => IntersectionCustom<T>;
|
|
1
|
+
import type { IntersectionCustom, NotReadonly, ObjectMapS } from "../types";
|
|
2
|
+
declare const intersection: <const T extends [ObjectMapS, ObjectMapS, ...ObjectMapS[]]>(...values: T) => IntersectionCustom<NotReadonly<T>>;
|
|
10
3
|
export { intersection };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"intersection.js","names":[],"sources":["../../src/helpers/intersection.ts"],"sourcesContent":["import type { ObjectMapS } from \"../types\";\n\
|
|
1
|
+
{"version":3,"file":"intersection.js","names":[],"sources":["../../src/helpers/intersection.ts"],"sourcesContent":["import type { IntersectionCustom, NotReadonly, ObjectMapS } from \"../types\";\n\nconst intersection = <\n const T extends [ObjectMapS, ObjectMapS, ...ObjectMapS[]],\n>(\n ...values: T\n) => {\n const out = values.reduce((acc, curr) => {\n Object.entries(curr).forEach(([key, value]) => {\n acc[key] = value;\n });\n return acc;\n }, {} as any);\n\n return out as IntersectionCustom<NotReadonly<T>>;\n};\n\nexport { intersection };\n"],"mappings":";AAEA,MAAM,gBAGJ,GAAG,WACA;AAQH,QAPY,OAAO,QAAQ,KAAK,SAAS;AACvC,SAAO,QAAQ,KAAK,CAAC,SAAS,CAAC,KAAK,WAAW;AAC7C,OAAI,OAAO;IACX;AACF,SAAO;IACN,EAAE,CAAQ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"optional.cjs","names":["OPTIONAL"],"sources":["../../src/helpers/optional.ts"],"sourcesContent":["import { OPTIONAL } from \"../constants\";\nimport type {
|
|
1
|
+
{"version":3,"file":"optional.cjs","names":["OPTIONAL"],"sources":["../../src/helpers/optional.ts"],"sourcesContent":["import { OPTIONAL } from \"../constants\";\nimport type {\n __ObjectT,\n AnyArray,\n ArrayCustom,\n NotReadonly,\n Optional,\n} from \"../types\";\n\nconst optional = <\n const T extends __ObjectT | ArrayCustom | AnyArray<__ObjectT>,\n>(\n value?: T,\n) =>\n ({\n [OPTIONAL]: value,\n }) as Optional<NotReadonly<T>>;\n\nexport { optional };\n"],"mappings":";;;AASA,MAAM,YAGJ,WAEC,GACEA,kBAAAA,WAAW,OACb"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { __ObjectT, AnyArray, ArrayCustom, Optional } from "../types";
|
|
2
|
-
declare const optional: <T extends __ObjectT | ArrayCustom | AnyArray<__ObjectT>>(value?: T) => Optional<T
|
|
1
|
+
import type { __ObjectT, AnyArray, ArrayCustom, NotReadonly, Optional } from "../types";
|
|
2
|
+
declare const optional: <const T extends __ObjectT | ArrayCustom | AnyArray<__ObjectT>>(value?: T) => Optional<NotReadonly<T>>;
|
|
3
3
|
export { optional };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"optional.js","names":[],"sources":["../../src/helpers/optional.ts"],"sourcesContent":["import { OPTIONAL } from \"../constants\";\nimport type {
|
|
1
|
+
{"version":3,"file":"optional.js","names":[],"sources":["../../src/helpers/optional.ts"],"sourcesContent":["import { OPTIONAL } from \"../constants\";\nimport type {\n __ObjectT,\n AnyArray,\n ArrayCustom,\n NotReadonly,\n Optional,\n} from \"../types\";\n\nconst optional = <\n const T extends __ObjectT | ArrayCustom | AnyArray<__ObjectT>,\n>(\n value?: T,\n) =>\n ({\n [OPTIONAL]: value,\n }) as Optional<NotReadonly<T>>;\n\nexport { optional };\n"],"mappings":";;AASA,MAAM,YAGJ,WAEC,GACE,WAAW,OACb"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"partial.cjs","names":["PARTIAL"],"sources":["../../src/helpers/partial.ts"],"sourcesContent":["import { PARTIAL } from \"../constants\";\nimport type { ObjectT, PartialCustom } from \"../types\";\n\nconst partial = <T extends ObjectT>(value: T): T & PartialCustom => {\n const entries = Object.entries(value).filter(([key]) => key !== PARTIAL);\n const out: any = {};\n\n entries.forEach(([key, value]) => {\n out[key] = value;\n });\n\n return out;\n};\n\nexport { partial };\n"],"mappings":";;;AAGA,MAAM,
|
|
1
|
+
{"version":3,"file":"partial.cjs","names":["PARTIAL"],"sources":["../../src/helpers/partial.ts"],"sourcesContent":["import { PARTIAL } from \"../constants\";\nimport type { NotReadonly, ObjectT, PartialCustom } from \"../types\";\n\nconst partial = <const T extends ObjectT>(\n value: T,\n): NotReadonly<T> & PartialCustom => {\n const entries = Object.entries(value).filter(([key]) => key !== PARTIAL);\n const out: any = {};\n\n entries.forEach(([key, value]) => {\n out[key] = value;\n });\n\n return out;\n};\n\nexport { partial };\n"],"mappings":";;;AAGA,MAAM,WACJ,UACmC;CACnC,MAAM,UAAU,OAAO,QAAQ,MAAM,CAAC,QAAQ,CAAC,SAAS,QAAQA,kBAAAA,QAAQ;CACxE,MAAM,MAAW,EAAE;AAEnB,SAAQ,SAAS,CAAC,KAAK,WAAW;AAChC,MAAI,OAAO;GACX;AAEF,QAAO"}
|
package/lib/helpers/partial.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { ObjectT, PartialCustom } from "../types";
|
|
2
|
-
declare const partial: <T extends ObjectT>(value: T) => T & PartialCustom;
|
|
1
|
+
import type { NotReadonly, ObjectT, PartialCustom } from "../types";
|
|
2
|
+
declare const partial: <const T extends ObjectT>(value: T) => NotReadonly<T> & PartialCustom;
|
|
3
3
|
export { partial };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"partial.js","names":[],"sources":["../../src/helpers/partial.ts"],"sourcesContent":["import { PARTIAL } from \"../constants\";\nimport type { ObjectT, PartialCustom } from \"../types\";\n\nconst partial = <T extends ObjectT>(value: T): T & PartialCustom => {\n const entries = Object.entries(value).filter(([key]) => key !== PARTIAL);\n const out: any = {};\n\n entries.forEach(([key, value]) => {\n out[key] = value;\n });\n\n return out;\n};\n\nexport { partial };\n"],"mappings":";;AAGA,MAAM,
|
|
1
|
+
{"version":3,"file":"partial.js","names":[],"sources":["../../src/helpers/partial.ts"],"sourcesContent":["import { PARTIAL } from \"../constants\";\nimport type { NotReadonly, ObjectT, PartialCustom } from \"../types\";\n\nconst partial = <const T extends ObjectT>(\n value: T,\n): NotReadonly<T> & PartialCustom => {\n const entries = Object.entries(value).filter(([key]) => key !== PARTIAL);\n const out: any = {};\n\n entries.forEach(([key, value]) => {\n out[key] = value;\n });\n\n return out;\n};\n\nexport { partial };\n"],"mappings":";;AAGA,MAAM,WACJ,UACmC;CACnC,MAAM,UAAU,OAAO,QAAQ,MAAM,CAAC,QAAQ,CAAC,SAAS,QAAQ,QAAQ;CACxE,MAAM,MAAW,EAAE;AAEnB,SAAQ,SAAS,CAAC,KAAK,WAAW;AAChC,MAAI,OAAO;GACX;AAEF,QAAO"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
//#region src/helpers/primitive.ts
|
|
3
|
+
const primitive = require("../utils/expandFn.cjs").expandFn((value) => value, {
|
|
4
|
+
boolean: (value) => {
|
|
5
|
+
return value;
|
|
6
|
+
},
|
|
7
|
+
string: (value) => {
|
|
8
|
+
return value;
|
|
9
|
+
},
|
|
10
|
+
number: (value) => {
|
|
11
|
+
return value;
|
|
12
|
+
},
|
|
13
|
+
bigint: (value) => {
|
|
14
|
+
return value;
|
|
15
|
+
},
|
|
16
|
+
symbol: (value) => {
|
|
17
|
+
return value;
|
|
18
|
+
},
|
|
19
|
+
never: () => {},
|
|
20
|
+
undefined: () => {}
|
|
21
|
+
});
|
|
22
|
+
//#endregion
|
|
23
|
+
exports.primitive = primitive;
|
|
24
|
+
|
|
25
|
+
//# sourceMappingURL=primitive.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"primitive.cjs","names":["expandFn"],"sources":["../../src/helpers/primitive.ts"],"sourcesContent":["import type { Custom, PrimitiveT } from \"../types\";\nimport { expandFn } from \"../utils/expandFn\";\n\nexport const primitive = expandFn(\n <const T extends PrimitiveT>(value?: T) => value as T,\n {\n boolean: <const T extends boolean>(value?: T) => {\n type TT = boolean extends T ? \"boolean\" : Custom<T>;\n return value as unknown as TT;\n },\n\n string: <const T extends string = string>(value?: T) => {\n type TT = string extends T ? \"string\" : Custom<T>;\n return value as unknown as TT;\n },\n\n number: <const T extends number = number>(value?: T) => {\n type TT = number extends T ? \"number\" : Custom<T>;\n return value as unknown as TT;\n },\n\n bigint: <const T extends bigint = bigint>(value?: T) => {\n type TT = bigint extends T ? \"bigint\" : Custom<T>;\n return value as unknown as TT;\n },\n\n symbol: <const T extends symbol = symbol>(value?: T) => {\n type TT = symbol extends T ? \"symbol\" : Custom<T>;\n return value as unknown as TT;\n },\n\n never: (): Custom<never> => {\n return undefined as any;\n },\n\n undefined: (): Custom<undefined> => {\n return undefined as any;\n },\n },\n);\n"],"mappings":";;AAGA,MAAa,6CAAYA,UACM,UAAc,OAC3C;CACE,UAAmC,UAAc;AAE/C,SAAO;;CAGT,SAA0C,UAAc;AAEtD,SAAO;;CAGT,SAA0C,UAAc;AAEtD,SAAO;;CAGT,SAA0C,UAAc;AAEtD,SAAO;;CAGT,SAA0C,UAAc;AAEtD,SAAO;;CAGT,aAA4B;CAI5B,iBAAoC;CAGrC,CACF"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Custom, PrimitiveT } from "../types";
|
|
2
|
+
export declare const primitive: import("..").FnBasic<(<const T extends PrimitiveT>(value?: T) => T), {
|
|
3
|
+
readonly boolean: <const T extends boolean>(value?: T) => boolean extends T ? "boolean" : Custom<T>;
|
|
4
|
+
readonly string: <const T extends string = string>(value?: T) => string extends T ? "string" : Custom<T>;
|
|
5
|
+
readonly number: <const T extends number = number>(value?: T) => number extends T ? "number" : Custom<T>;
|
|
6
|
+
readonly bigint: <const T extends bigint = bigint>(value?: T) => bigint extends T ? "bigint" : Custom<T>;
|
|
7
|
+
readonly symbol: <const T extends symbol = symbol>(value?: T) => symbol extends T ? "symbol" : Custom<T>;
|
|
8
|
+
readonly never: () => Custom<never>;
|
|
9
|
+
readonly undefined: () => Custom<undefined>;
|
|
10
|
+
}>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { expandFn } from "../utils/expandFn.js";
|
|
2
|
+
//#region src/helpers/primitive.ts
|
|
3
|
+
const primitive = expandFn((value) => value, {
|
|
4
|
+
boolean: (value) => {
|
|
5
|
+
return value;
|
|
6
|
+
},
|
|
7
|
+
string: (value) => {
|
|
8
|
+
return value;
|
|
9
|
+
},
|
|
10
|
+
number: (value) => {
|
|
11
|
+
return value;
|
|
12
|
+
},
|
|
13
|
+
bigint: (value) => {
|
|
14
|
+
return value;
|
|
15
|
+
},
|
|
16
|
+
symbol: (value) => {
|
|
17
|
+
return value;
|
|
18
|
+
},
|
|
19
|
+
never: () => {},
|
|
20
|
+
undefined: () => {}
|
|
21
|
+
});
|
|
22
|
+
//#endregion
|
|
23
|
+
export { primitive };
|
|
24
|
+
|
|
25
|
+
//# sourceMappingURL=primitive.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"primitive.js","names":[],"sources":["../../src/helpers/primitive.ts"],"sourcesContent":["import type { Custom, PrimitiveT } from \"../types\";\nimport { expandFn } from \"../utils/expandFn\";\n\nexport const primitive = expandFn(\n <const T extends PrimitiveT>(value?: T) => value as T,\n {\n boolean: <const T extends boolean>(value?: T) => {\n type TT = boolean extends T ? \"boolean\" : Custom<T>;\n return value as unknown as TT;\n },\n\n string: <const T extends string = string>(value?: T) => {\n type TT = string extends T ? \"string\" : Custom<T>;\n return value as unknown as TT;\n },\n\n number: <const T extends number = number>(value?: T) => {\n type TT = number extends T ? \"number\" : Custom<T>;\n return value as unknown as TT;\n },\n\n bigint: <const T extends bigint = bigint>(value?: T) => {\n type TT = bigint extends T ? \"bigint\" : Custom<T>;\n return value as unknown as TT;\n },\n\n symbol: <const T extends symbol = symbol>(value?: T) => {\n type TT = symbol extends T ? \"symbol\" : Custom<T>;\n return value as unknown as TT;\n },\n\n never: (): Custom<never> => {\n return undefined as any;\n },\n\n undefined: (): Custom<undefined> => {\n return undefined as any;\n },\n },\n);\n"],"mappings":";;AAGA,MAAa,YAAY,UACM,UAAc,OAC3C;CACE,UAAmC,UAAc;AAE/C,SAAO;;CAGT,SAA0C,UAAc;AAEtD,SAAO;;CAGT,SAA0C,UAAc;AAEtD,SAAO;;CAGT,SAA0C,UAAc;AAEtD,SAAO;;CAGT,SAA0C,UAAc;AAEtD,SAAO;;CAGT,aAA4B;CAI5B,iBAAoC;CAGrC,CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"primitiveObject.cjs","names":["expandFn"],"sources":["../../src/helpers/primitiveObject.ts"],"sourcesContent":["import type {\n NotReadonly,\n PrimitiveObjectMapS,\n PrimitiveObjectT,\n} from \"../types\";\nimport { expandFn } from \"../utils/expandFn\";\n\nconst primitiveObject = expandFn(\n
|
|
1
|
+
{"version":3,"file":"primitiveObject.cjs","names":["expandFn"],"sources":["../../src/helpers/primitiveObject.ts"],"sourcesContent":["import type {\n IntersectionCustom,\n NotReadonly,\n PrimitiveObjectMapS,\n PrimitiveObjectT,\n} from \"../types\";\nimport { expandFn } from \"../utils/expandFn\";\n\nconst primitiveObject = expandFn(\n <\n const T extends\n | PrimitiveObjectT\n | IntersectionCustom<PrimitiveObjectMapS[]> = PrimitiveObjectT,\n >(\n value?: T,\n ): NotReadonly<T> => {\n return (value || {}) as any;\n },\n {\n map: <\n const T extends\n | PrimitiveObjectMapS\n | IntersectionCustom<PrimitiveObjectMapS[]> = PrimitiveObjectMapS,\n >(\n value?: T,\n ): NotReadonly<T> => {\n return (value || {}) as any;\n },\n },\n);\n\nexport { primitiveObject };\n"],"mappings":";;AAQA,MAAM,mDAAkBA,UAMpB,UACmB;AACnB,QAAQ,SAAS,EAAE;GAErB,EACE,MAKE,UACmB;AACnB,QAAQ,SAAS,EAAE;GAEtB,CACF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { NotReadonly, PrimitiveObjectMapS, PrimitiveObjectT } from "../types";
|
|
2
|
-
declare const primitiveObject: import("..").FnBasic<(<const T extends PrimitiveObjectT = PrimitiveObjectT>(value?: T) =>
|
|
3
|
-
readonly map: <const T extends PrimitiveObjectMapS = PrimitiveObjectMapS>(value?: T) =>
|
|
1
|
+
import type { IntersectionCustom, NotReadonly, PrimitiveObjectMapS, PrimitiveObjectT } from "../types";
|
|
2
|
+
declare const primitiveObject: import("..").FnBasic<(<const T extends PrimitiveObjectT | IntersectionCustom<PrimitiveObjectMapS[]> = PrimitiveObjectT>(value?: T) => NotReadonly<T>), {
|
|
3
|
+
readonly map: <const T extends PrimitiveObjectMapS | IntersectionCustom<PrimitiveObjectMapS[]> = PrimitiveObjectMapS>(value?: T) => NotReadonly<T>;
|
|
4
4
|
}>;
|
|
5
5
|
export { primitiveObject };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"primitiveObject.js","names":[],"sources":["../../src/helpers/primitiveObject.ts"],"sourcesContent":["import type {\n NotReadonly,\n PrimitiveObjectMapS,\n PrimitiveObjectT,\n} from \"../types\";\nimport { expandFn } from \"../utils/expandFn\";\n\nconst primitiveObject = expandFn(\n
|
|
1
|
+
{"version":3,"file":"primitiveObject.js","names":[],"sources":["../../src/helpers/primitiveObject.ts"],"sourcesContent":["import type {\n IntersectionCustom,\n NotReadonly,\n PrimitiveObjectMapS,\n PrimitiveObjectT,\n} from \"../types\";\nimport { expandFn } from \"../utils/expandFn\";\n\nconst primitiveObject = expandFn(\n <\n const T extends\n | PrimitiveObjectT\n | IntersectionCustom<PrimitiveObjectMapS[]> = PrimitiveObjectT,\n >(\n value?: T,\n ): NotReadonly<T> => {\n return (value || {}) as any;\n },\n {\n map: <\n const T extends\n | PrimitiveObjectMapS\n | IntersectionCustom<PrimitiveObjectMapS[]> = PrimitiveObjectMapS,\n >(\n value?: T,\n ): NotReadonly<T> => {\n return (value || {}) as any;\n },\n },\n);\n\nexport { primitiveObject };\n"],"mappings":";;AAQA,MAAM,kBAAkB,UAMpB,UACmB;AACnB,QAAQ,SAAS,EAAE;GAErB,EACE,MAKE,UACmB;AACnB,QAAQ,SAAS,EAAE;GAEtB,CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"readonly.cjs","names":[],"sources":["../../src/helpers/readonly.ts"],"sourcesContent":["import type { ObjectT } from \"../types\";\n\nexport const readonly = <const T extends ObjectT>(value: T) => value;\n"],"mappings":";;AAEA,MAAa,YAAqC,UAAa"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"readonly.js","names":[],"sources":["../../src/helpers/readonly.ts"],"sourcesContent":["import type { ObjectT } from \"../types\";\n\nexport const readonly = <const T extends ObjectT>(value: T) => value;\n"],"mappings":";AAEA,MAAa,YAAqC,UAAa"}
|
package/lib/helpers/soa.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"soa.cjs","names":["SOA"],"sources":["../../src/helpers/soa.ts"],"sourcesContent":["import { SOA } from \"../constants\";\nimport type { NotReadonly, ObjectT, SoaCustom } from \"../types\";\n\nconst soa = <const T extends ObjectT>(value: T) => {\n
|
|
1
|
+
{"version":3,"file":"soa.cjs","names":["SOA"],"sources":["../../src/helpers/soa.ts"],"sourcesContent":["import { SOA } from \"../constants\";\nimport type { NotReadonly, ObjectT, SoaCustom } from \"../types\";\n\nconst soa = <const T extends ObjectT>(value: T) => {\n return { [SOA]: value } as SoaCustom<NotReadonly<T>>;\n};\n\nexport { soa };\n"],"mappings":";;;AAGA,MAAM,OAAgC,UAAa;AACjD,QAAO,GAAGA,kBAAAA,MAAM,OAAO"}
|
package/lib/helpers/soa.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { NotReadonly, ObjectT, SoaCustom } from "../types";
|
|
2
|
-
declare const soa: <const T extends ObjectT>(value: T) => SoaCustom<
|
|
2
|
+
declare const soa: <const T extends ObjectT>(value: T) => SoaCustom<NotReadonly<T>>;
|
|
3
3
|
export { soa };
|
package/lib/helpers/soa.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"soa.js","names":[],"sources":["../../src/helpers/soa.ts"],"sourcesContent":["import { SOA } from \"../constants\";\nimport type { NotReadonly, ObjectT, SoaCustom } from \"../types\";\n\nconst soa = <const T extends ObjectT>(value: T) => {\n
|
|
1
|
+
{"version":3,"file":"soa.js","names":[],"sources":["../../src/helpers/soa.ts"],"sourcesContent":["import { SOA } from \"../constants\";\nimport type { NotReadonly, ObjectT, SoaCustom } from \"../types\";\n\nconst soa = <const T extends ObjectT>(value: T) => {\n return { [SOA]: value } as SoaCustom<NotReadonly<T>>;\n};\n\nexport { soa };\n"],"mappings":";;AAGA,MAAM,OAAgC,UAAa;AACjD,QAAO,GAAG,MAAM,OAAO"}
|
package/lib/helpers/sv.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sv.cjs","names":[],"sources":["../../src/helpers/sv.ts"],"sourcesContent":["import type { Custom, StateValue } from \"../types\";\
|
|
1
|
+
{"version":3,"file":"sv.cjs","names":[],"sources":["../../src/helpers/sv.ts"],"sourcesContent":["import type { Custom, StateValue } from \"../types\";\nconst sv = {} as Custom<StateValue>;\nexport { sv };\n"],"mappings":";;AACA,MAAM,KAAK,EAAE"}
|
package/lib/helpers/sv.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sv.js","names":[],"sources":["../../src/helpers/sv.ts"],"sourcesContent":["import type { Custom, StateValue } from \"../types\";\
|
|
1
|
+
{"version":3,"file":"sv.js","names":[],"sources":["../../src/helpers/sv.ts"],"sourcesContent":["import type { Custom, StateValue } from \"../types\";\nconst sv = {} as Custom<StateValue>;\nexport { sv };\n"],"mappings":";AACA,MAAM,KAAK,EAAE"}
|
package/lib/type.types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { any, array, custom, intersection, litterals, optional, partial, primitiveObject, record, soa, sv, tuple, union } from "./helpers";
|
|
2
1
|
import type { inferT, ObjectT } from "./types";
|
|
2
|
+
import type { any, array, custom, intersection, litterals, optional, partial, primitive, primitiveObject, readonly, record, soa, sv, tuple, union } from "./helpers";
|
|
3
3
|
export type Helpers = {
|
|
4
4
|
any: typeof any;
|
|
5
5
|
custom: typeof custom;
|
|
@@ -14,5 +14,7 @@ export type Helpers = {
|
|
|
14
14
|
array: typeof array;
|
|
15
15
|
tuple: typeof tuple;
|
|
16
16
|
primitiveObject: typeof primitiveObject;
|
|
17
|
+
primitive: typeof primitive;
|
|
18
|
+
readonly: typeof readonly;
|
|
17
19
|
};
|
|
18
20
|
export type Transform_F = <T extends ObjectT = ObjectT>(option?: ((helpers: Helpers) => T) | T) => inferT<T>;
|
package/lib/types.d.ts
CHANGED
|
@@ -24,11 +24,11 @@ type RecursiveArrayOf<T> = Array<_SingleOrRecursiveArrayOf<T>> | ReadonlyArray<_
|
|
|
24
24
|
type _SingleOrRecursiveArrayOf<T> = T | RecursiveArrayOf<T>;
|
|
25
25
|
export type SingleOrRecursiveArrayOf<T> = T | RecursiveArrayOf<T>;
|
|
26
26
|
export type SoRa<T> = SingleOrRecursiveArrayOf<T>;
|
|
27
|
-
export type Primiive = string | number | boolean | bigint | null | undefined | symbol |
|
|
28
|
-
export type
|
|
29
|
-
type TransformPrimitiveS<T extends
|
|
30
|
-
export type Types =
|
|
31
|
-
export type TransformTypes<T extends Types> = T extends
|
|
27
|
+
export type Primiive = string | number | boolean | bigint | null | undefined | symbol | never;
|
|
28
|
+
export type PrimitiveT = (typeof PRIMITIVES)[number];
|
|
29
|
+
type TransformPrimitiveS<T extends PrimitiveT> = T extends "string" ? string : T extends "number" ? number : T extends "boolean" ? boolean : T extends "bigint" ? bigint : T extends "null" ? null : T extends "undefined" ? undefined : T extends "symbol" ? symbol : T extends "never" ? never : Primiive;
|
|
30
|
+
export type Types = PrimitiveT | (typeof PRIMITIVE_OBJECTS)[number];
|
|
31
|
+
export type TransformTypes<T extends Types> = T extends PrimitiveT ? TransformPrimitiveS<T> : T extends "date" ? Date : T extends "any" ? any : T extends "unknown" ? unknown : object;
|
|
32
32
|
export type Custom<T = any> = {
|
|
33
33
|
[CUSTOM]: T;
|
|
34
34
|
};
|
|
@@ -52,8 +52,12 @@ export declare class OptionalHelperClass {
|
|
|
52
52
|
readonly __NO_TYPE__ = "@bemedev/addons/NO_TYPE";
|
|
53
53
|
private constructor();
|
|
54
54
|
}
|
|
55
|
+
export type IntersectionCustom<T extends ObjectMapS[]> = T extends [
|
|
56
|
+
infer First extends ObjectMapS,
|
|
57
|
+
...infer Rest extends ObjectMapS[]
|
|
58
|
+
] ? First & IntersectionCustom<Rest> : unknown;
|
|
55
59
|
type _ObjectT = __ObjectT | Optional | ArrayCustom;
|
|
56
|
-
export type PrimitiveObjectT = Types | ArrayCustom<Types> | Optional<Types> | PrimitiveObjectMapS | (PrimitiveObjectMapS & PartialCustom)
|
|
60
|
+
export type PrimitiveObjectT = SoRa<Types | ArrayCustom<Types> | Optional<Types> | PrimitiveObjectMapS | (PrimitiveObjectMapS & PartialCustom)>;
|
|
57
61
|
export interface PrimitiveObjectMapS {
|
|
58
62
|
[key: Keys]: PrimitiveObjectT;
|
|
59
63
|
}
|
|
@@ -75,7 +79,7 @@ type ReduceTupleU<T extends AnyArray> = T extends [
|
|
|
75
79
|
type __TransformPrimitiveObject<T> = T extends Types ? TransformTypes<T> : T extends ArrayCustom<infer A> ? TransformT<A>[] : T extends SoaCustom<infer TSoA> ? SoA<__TransformPrimitiveObject<TSoA>> : T extends Custom<infer TCustom> ? TCustom : T extends AnyArray<ObjectT> ? ReduceTuple2<T> : T extends PartialCustom ? Partial<__TransformPrimitiveObject<NOmit<T, typeof PARTIAL>>> : T extends Optional<infer TOptional> ? __TransformPrimitiveObject<TOptional> | OptionalHelperClass : {
|
|
76
80
|
[K in keyof T]: __TransformPrimitiveObject<T[K]>;
|
|
77
81
|
};
|
|
78
|
-
type HasUndefined<T> = OptionalHelperClass extends T ? true : false;
|
|
82
|
+
type HasUndefined<T> = unknown extends T ? false : OptionalHelperClass extends T ? true : false;
|
|
79
83
|
type UndefinyObject<T extends object> = {
|
|
80
84
|
[K in keyof T as HasUndefined<T[K]> extends true ? never : K]: Undefiny<T[K]>;
|
|
81
85
|
} & {
|