@bemedev/typings 0.2.1 → 0.3.0

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 (91) hide show
  1. package/lib/constants.cjs +2 -4
  2. package/lib/constants.d.ts +2 -2
  3. package/lib/constants.js +2 -4
  4. package/lib/helpers/any.cjs +3 -3
  5. package/lib/helpers/any.d.ts +2 -2
  6. package/lib/helpers/any.js +3 -3
  7. package/lib/helpers/array.cjs +0 -2
  8. package/lib/helpers/array.d.ts +2 -2
  9. package/lib/helpers/array.js +0 -2
  10. package/lib/helpers/custom.cjs +0 -2
  11. package/lib/helpers/custom.js +0 -2
  12. package/lib/helpers/index.cjs +5 -27
  13. package/lib/helpers/index.d.ts +3 -1
  14. package/lib/helpers/index.js +4 -22
  15. package/lib/helpers/intersection.cjs +0 -2
  16. package/lib/helpers/intersection.d.ts +2 -9
  17. package/lib/helpers/intersection.js +0 -2
  18. package/lib/helpers/litterals.cjs +0 -2
  19. package/lib/helpers/litterals.js +0 -2
  20. package/lib/helpers/optional.cjs +0 -2
  21. package/lib/helpers/optional.d.ts +2 -2
  22. package/lib/helpers/optional.js +0 -2
  23. package/lib/helpers/partial.cjs +0 -2
  24. package/lib/helpers/partial.d.ts +2 -2
  25. package/lib/helpers/partial.js +0 -2
  26. package/lib/helpers/primitive.cjs +23 -0
  27. package/lib/helpers/primitive.d.ts +10 -0
  28. package/lib/helpers/primitive.js +23 -0
  29. package/lib/helpers/primitiveObject.cjs +0 -2
  30. package/lib/helpers/primitiveObject.d.ts +3 -3
  31. package/lib/helpers/primitiveObject.js +0 -2
  32. package/lib/helpers/readonly.cjs +5 -0
  33. package/lib/helpers/readonly.d.ts +2 -0
  34. package/lib/helpers/readonly.js +4 -0
  35. package/lib/helpers/record.cjs +0 -2
  36. package/lib/helpers/record.js +0 -2
  37. package/lib/helpers/soa.cjs +0 -2
  38. package/lib/helpers/soa.d.ts +1 -1
  39. package/lib/helpers/soa.js +0 -2
  40. package/lib/helpers/sv.cjs +0 -2
  41. package/lib/helpers/sv.js +0 -2
  42. package/lib/helpers/tuple.cjs +0 -2
  43. package/lib/helpers/tuple.js +0 -2
  44. package/lib/helpers/union.cjs +0 -2
  45. package/lib/helpers/union.js +0 -2
  46. package/lib/index.cjs +0 -9
  47. package/lib/index.d.ts +0 -1
  48. package/lib/index.js +1 -3
  49. package/lib/type.cjs +58 -0
  50. package/lib/type.js +57 -0
  51. package/lib/type.types.d.ts +3 -1
  52. package/lib/types.cjs +0 -0
  53. package/lib/types.d.ts +12 -8
  54. package/lib/types.js +1 -0
  55. package/lib/utils/expandFn.cjs +0 -2
  56. package/lib/utils/expandFn.js +0 -2
  57. package/package.json +15 -1
  58. package/lib/_virtual/_rolldown/runtime.cjs +0 -13
  59. package/lib/_virtual/_rolldown/runtime.js +0 -13
  60. package/lib/constants.cjs.map +0 -1
  61. package/lib/constants.js.map +0 -1
  62. package/lib/helpers/any.cjs.map +0 -1
  63. package/lib/helpers/any.js.map +0 -1
  64. package/lib/helpers/array.cjs.map +0 -1
  65. package/lib/helpers/array.js.map +0 -1
  66. package/lib/helpers/custom.cjs.map +0 -1
  67. package/lib/helpers/custom.js.map +0 -1
  68. package/lib/helpers/index.cjs.map +0 -1
  69. package/lib/helpers/index.js.map +0 -1
  70. package/lib/helpers/intersection.cjs.map +0 -1
  71. package/lib/helpers/intersection.js.map +0 -1
  72. package/lib/helpers/litterals.cjs.map +0 -1
  73. package/lib/helpers/litterals.js.map +0 -1
  74. package/lib/helpers/optional.cjs.map +0 -1
  75. package/lib/helpers/optional.js.map +0 -1
  76. package/lib/helpers/partial.cjs.map +0 -1
  77. package/lib/helpers/partial.js.map +0 -1
  78. package/lib/helpers/primitiveObject.cjs.map +0 -1
  79. package/lib/helpers/primitiveObject.js.map +0 -1
  80. package/lib/helpers/record.cjs.map +0 -1
  81. package/lib/helpers/record.js.map +0 -1
  82. package/lib/helpers/soa.cjs.map +0 -1
  83. package/lib/helpers/soa.js.map +0 -1
  84. package/lib/helpers/sv.cjs.map +0 -1
  85. package/lib/helpers/sv.js.map +0 -1
  86. package/lib/helpers/tuple.cjs.map +0 -1
  87. package/lib/helpers/tuple.js.map +0 -1
  88. package/lib/helpers/union.cjs.map +0 -1
  89. package/lib/helpers/union.js.map +0 -1
  90. package/lib/utils/expandFn.cjs.map +0 -1
  91. package/lib/utils/expandFn.js.map +0 -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$$";
@@ -30,5 +30,3 @@ exports.PARTIAL = PARTIAL;
30
30
  exports.PRIMITIVES = PRIMITIVES;
31
31
  exports.PRIMITIVE_OBJECTS = PRIMITIVE_OBJECTS;
32
32
  exports.SOA = SOA;
33
-
34
- //# sourceMappingURL=constants.cjs.map
@@ -1,5 +1,5 @@
1
- export declare const PRIMITIVES: readonly ["string", "number", "boolean", "bigint", "symbol", "undefined", "null", "unknown", "never", "primitive"];
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$$";
@@ -23,5 +23,3 @@ const ARRAY = "$$app-ts => array$$";
23
23
  const SOA = "$$app-ts => soa$$";
24
24
  //#endregion
25
25
  export { ARRAY, CUSTOM, OPTIONAL, PARTIAL, PRIMITIVES, PRIMITIVE_OBJECTS, SOA };
26
-
27
- //# sourceMappingURL=constants.js.map
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  //#region src/helpers/any.ts
3
- const any = (value) => value;
3
+ const any = (value) => {
4
+ return value;
5
+ };
4
6
  //#endregion
5
7
  exports.any = any;
6
-
7
- //# sourceMappingURL=any.cjs.map
@@ -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 };
@@ -1,6 +1,6 @@
1
1
  //#region src/helpers/any.ts
2
- const any = (value) => value;
2
+ const any = (value) => {
3
+ return value;
4
+ };
3
5
  //#endregion
4
6
  export { any };
5
-
6
- //# sourceMappingURL=any.js.map
@@ -6,5 +6,3 @@ const array = (value) => {
6
6
  };
7
7
  //#endregion
8
8
  exports.array = array;
9
-
10
- //# sourceMappingURL=array.cjs.map
@@ -1,3 +1,3 @@
1
- import type { ArrayCustom, NotReadonly, ObjectT } from "../types";
2
- declare const array: <const T extends ObjectT>(value: T) => ArrayCustom<Extract<NotReadonly<T>, ObjectT>>;
1
+ import type { ArrayCustom, ObjectT } from "../types";
2
+ declare const array: <T extends ObjectT>(value: T) => ArrayCustom<T>;
3
3
  export { array };
@@ -5,5 +5,3 @@ const array = (value) => {
5
5
  };
6
6
  //#endregion
7
7
  export { array };
8
-
9
- //# sourceMappingURL=array.js.map
@@ -4,5 +4,3 @@ const require_constants = require("../constants.cjs");
4
4
  const custom = (value) => ({ [require_constants.CUSTOM]: value });
5
5
  //#endregion
6
6
  exports.custom = custom;
7
-
8
- //# sourceMappingURL=custom.cjs.map
@@ -3,5 +3,3 @@ import { CUSTOM } from "../constants.js";
3
3
  const custom = (value) => ({ [CUSTOM]: value });
4
4
  //#endregion
5
5
  export { custom };
6
-
7
- //# sourceMappingURL=custom.js.map
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_runtime = require("../_virtual/_rolldown/runtime.cjs");
2
+ const require_helpers_readonly = require("./readonly.cjs");
3
3
  const require_helpers_any = require("./any.cjs");
4
4
  const require_helpers_array = require("./array.cjs");
5
5
  const require_helpers_custom = require("./custom.cjs");
@@ -7,47 +7,25 @@ const require_helpers_intersection = require("./intersection.cjs");
7
7
  const require_helpers_litterals = require("./litterals.cjs");
8
8
  const require_helpers_optional = require("./optional.cjs");
9
9
  const require_helpers_partial = require("./partial.cjs");
10
+ const require_helpers_primitive = require("./primitive.cjs");
11
+ const require_helpers_primitiveObject = require("./primitiveObject.cjs");
10
12
  const require_helpers_record = require("./record.cjs");
11
13
  const require_helpers_soa = require("./soa.cjs");
12
14
  const require_helpers_sv = require("./sv.cjs");
13
15
  const require_helpers_tuple = require("./tuple.cjs");
14
16
  const require_helpers_union = require("./union.cjs");
15
- const require_helpers_primitiveObject = require("./primitiveObject.cjs");
16
- //#region src/helpers/index.ts
17
- var helpers_exports = /* @__PURE__ */ require_runtime.__exportAll({
18
- any: () => require_helpers_any.any,
19
- array: () => require_helpers_array.array,
20
- custom: () => require_helpers_custom.custom,
21
- intersection: () => require_helpers_intersection.intersection,
22
- litterals: () => require_helpers_litterals.litterals,
23
- optional: () => require_helpers_optional.optional,
24
- partial: () => require_helpers_partial.partial,
25
- primitiveObject: () => require_helpers_primitiveObject.primitiveObject,
26
- record: () => require_helpers_record.record,
27
- soa: () => require_helpers_soa.soa,
28
- sv: () => require_helpers_sv.sv,
29
- tuple: () => require_helpers_tuple.tuple,
30
- union: () => require_helpers_union.union
31
- });
32
- //#endregion
33
17
  exports.any = require_helpers_any.any;
34
18
  exports.array = require_helpers_array.array;
35
19
  exports.custom = require_helpers_custom.custom;
36
- Object.defineProperty(exports, "helpers_exports", {
37
- enumerable: true,
38
- get: function() {
39
- return helpers_exports;
40
- }
41
- });
42
20
  exports.intersection = require_helpers_intersection.intersection;
43
21
  exports.litterals = require_helpers_litterals.litterals;
44
22
  exports.optional = require_helpers_optional.optional;
45
23
  exports.partial = require_helpers_partial.partial;
24
+ exports.primitive = require_helpers_primitive.primitive;
46
25
  exports.primitiveObject = require_helpers_primitiveObject.primitiveObject;
26
+ exports.readonly = require_helpers_readonly.readonly;
47
27
  exports.record = require_helpers_record.record;
48
28
  exports.soa = require_helpers_soa.soa;
49
29
  exports.sv = require_helpers_sv.sv;
50
30
  exports.tuple = require_helpers_tuple.tuple;
51
31
  exports.union = require_helpers_union.union;
52
-
53
- //# sourceMappingURL=index.cjs.map
@@ -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";
@@ -1,4 +1,4 @@
1
- import { __exportAll } from "../_virtual/_rolldown/runtime.js";
1
+ import { readonly } from "./readonly.js";
2
2
  import { any } from "./any.js";
3
3
  import { array } from "./array.js";
4
4
  import { custom } from "./custom.js";
@@ -6,29 +6,11 @@ import { intersection } from "./intersection.js";
6
6
  import { litterals } from "./litterals.js";
7
7
  import { optional } from "./optional.js";
8
8
  import { partial } from "./partial.js";
9
+ import { primitive } from "./primitive.js";
10
+ import { primitiveObject } from "./primitiveObject.js";
9
11
  import { record } from "./record.js";
10
12
  import { soa } from "./soa.js";
11
13
  import { sv } from "./sv.js";
12
14
  import { tuple } from "./tuple.js";
13
15
  import { union } from "./union.js";
14
- import { primitiveObject } from "./primitiveObject.js";
15
- //#region src/helpers/index.ts
16
- var helpers_exports = /* @__PURE__ */ __exportAll({
17
- any: () => any,
18
- array: () => array,
19
- custom: () => custom,
20
- intersection: () => intersection,
21
- litterals: () => litterals,
22
- optional: () => optional,
23
- partial: () => partial,
24
- primitiveObject: () => primitiveObject,
25
- record: () => record,
26
- soa: () => soa,
27
- sv: () => sv,
28
- tuple: () => tuple,
29
- union: () => union
30
- });
31
- //#endregion
32
- export { any, array, custom, helpers_exports, intersection, litterals, optional, partial, primitiveObject, record, soa, sv, tuple, union };
33
-
34
- //# sourceMappingURL=index.js.map
16
+ export { any, array, custom, intersection, litterals, optional, partial, primitive, primitiveObject, readonly, record, soa, sv, tuple, union };
@@ -10,5 +10,3 @@ const intersection = (...values) => {
10
10
  };
11
11
  //#endregion
12
12
  exports.intersection = intersection;
13
-
14
- //# sourceMappingURL=intersection.cjs.map
@@ -1,10 +1,3 @@
1
- import type { ObjectMapS } from "../types";
2
- type _IntersectionCustom<T extends ObjectMapS[]> = T extends [
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 };
@@ -9,5 +9,3 @@ const intersection = (...values) => {
9
9
  };
10
10
  //#endregion
11
11
  export { intersection };
12
-
13
- //# sourceMappingURL=intersection.js.map
@@ -3,5 +3,3 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const litterals = (...values) => values[0];
4
4
  //#endregion
5
5
  exports.litterals = litterals;
6
-
7
- //# sourceMappingURL=litterals.cjs.map
@@ -2,5 +2,3 @@
2
2
  const litterals = (...values) => values[0];
3
3
  //#endregion
4
4
  export { litterals };
5
-
6
- //# sourceMappingURL=litterals.js.map
@@ -4,5 +4,3 @@ const require_constants = require("../constants.cjs");
4
4
  const optional = (value) => ({ [require_constants.OPTIONAL]: value });
5
5
  //#endregion
6
6
  exports.optional = optional;
7
-
8
- //# sourceMappingURL=optional.cjs.map
@@ -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 };
@@ -3,5 +3,3 @@ import { OPTIONAL } from "../constants.js";
3
3
  const optional = (value) => ({ [OPTIONAL]: value });
4
4
  //#endregion
5
5
  export { optional };
6
-
7
- //# sourceMappingURL=optional.js.map
@@ -11,5 +11,3 @@ const partial = (value) => {
11
11
  };
12
12
  //#endregion
13
13
  exports.partial = partial;
14
-
15
- //# sourceMappingURL=partial.cjs.map
@@ -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 };
@@ -10,5 +10,3 @@ const partial = (value) => {
10
10
  };
11
11
  //#endregion
12
12
  export { partial };
13
-
14
- //# sourceMappingURL=partial.js.map
@@ -0,0 +1,23 @@
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;
@@ -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,23 @@
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 };
@@ -7,5 +7,3 @@ const primitiveObject = require("../utils/expandFn.cjs").expandFn((value) => {
7
7
  } });
8
8
  //#endregion
9
9
  exports.primitiveObject = primitiveObject;
10
-
11
- //# sourceMappingURL=primitiveObject.cjs.map
@@ -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) => Exclude<NotReadonly<T>, undefined>), {
3
- readonly map: <const T extends PrimitiveObjectMapS = PrimitiveObjectMapS>(value?: T) => Exclude<NotReadonly<T>, undefined>;
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 };
@@ -7,5 +7,3 @@ const primitiveObject = expandFn((value) => {
7
7
  } });
8
8
  //#endregion
9
9
  export { primitiveObject };
10
-
11
- //# sourceMappingURL=primitiveObject.js.map
@@ -0,0 +1,5 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ //#region src/helpers/readonly.ts
3
+ const readonly = (value) => value;
4
+ //#endregion
5
+ exports.readonly = readonly;
@@ -0,0 +1,2 @@
1
+ import type { ObjectT } from "../types";
2
+ export declare const readonly: <const T extends ObjectT>(value: T) => T;
@@ -0,0 +1,4 @@
1
+ //#region src/helpers/readonly.ts
2
+ const readonly = (value) => value;
3
+ //#endregion
4
+ export { readonly };
@@ -8,5 +8,3 @@ const record = (value, ...keys) => {
8
8
  };
9
9
  //#endregion
10
10
  exports.record = record;
11
-
12
- //# sourceMappingURL=record.cjs.map
@@ -7,5 +7,3 @@ const record = (value, ...keys) => {
7
7
  };
8
8
  //#endregion
9
9
  export { record };
10
-
11
- //# sourceMappingURL=record.js.map
@@ -6,5 +6,3 @@ const soa = (value) => {
6
6
  };
7
7
  //#endregion
8
8
  exports.soa = soa;
9
-
10
- //# sourceMappingURL=soa.cjs.map
@@ -1,3 +1,3 @@
1
1
  import type { NotReadonly, ObjectT, SoaCustom } from "../types";
2
- declare const soa: <const T extends ObjectT>(value: T) => SoaCustom<Extract<NotReadonly<T>, ObjectT>>;
2
+ declare const soa: <const T extends ObjectT>(value: T) => SoaCustom<NotReadonly<T>>;
3
3
  export { soa };
@@ -5,5 +5,3 @@ const soa = (value) => {
5
5
  };
6
6
  //#endregion
7
7
  export { soa };
8
-
9
- //# sourceMappingURL=soa.js.map
@@ -3,5 +3,3 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const sv = {};
4
4
  //#endregion
5
5
  exports.sv = sv;
6
-
7
- //# sourceMappingURL=sv.cjs.map
package/lib/helpers/sv.js CHANGED
@@ -2,5 +2,3 @@
2
2
  const sv = {};
3
3
  //#endregion
4
4
  export { sv };
5
-
6
- //# sourceMappingURL=sv.js.map
@@ -3,5 +3,3 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const tuple = (...values) => values;
4
4
  //#endregion
5
5
  exports.tuple = tuple;
6
-
7
- //# sourceMappingURL=tuple.cjs.map
@@ -2,5 +2,3 @@
2
2
  const tuple = (...values) => values;
3
3
  //#endregion
4
4
  export { tuple };
5
-
6
- //# sourceMappingURL=tuple.js.map
@@ -7,5 +7,3 @@ const _union = (...values) => {
7
7
  const union = require_utils_expandFn.expandFn(_union, { discriminated: (_key, ...values) => _union(...values) });
8
8
  //#endregion
9
9
  exports.union = union;
10
-
11
- //# sourceMappingURL=union.cjs.map
@@ -6,5 +6,3 @@ const _union = (...values) => {
6
6
  const union = expandFn(_union, { discriminated: (_key, ...values) => _union(...values) });
7
7
  //#endregion
8
8
  export { union };
9
-
10
- //# sourceMappingURL=union.js.map
package/lib/index.cjs CHANGED
@@ -1,20 +1,11 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_types = require("./types.cjs");
3
2
  const require_constants = require("./constants.cjs");
4
- const require_helpers_index = require("./helpers/index.cjs");
5
3
  const require_type = require("./type.cjs");
6
4
  exports.ARRAY = require_constants.ARRAY;
7
5
  exports.CUSTOM = require_constants.CUSTOM;
8
6
  exports.OPTIONAL = require_constants.OPTIONAL;
9
- exports.OptionalHelperClass = require_types.OptionalHelperClass;
10
7
  exports.PARTIAL = require_constants.PARTIAL;
11
8
  exports.PRIMITIVES = require_constants.PRIMITIVES;
12
9
  exports.PRIMITIVE_OBJECTS = require_constants.PRIMITIVE_OBJECTS;
13
10
  exports.SOA = require_constants.SOA;
14
- Object.defineProperty(exports, "helpers", {
15
- enumerable: true,
16
- get: function() {
17
- return require_helpers_index.helpers_exports;
18
- }
19
- });
20
11
  exports.type = require_type.type;
package/lib/index.d.ts CHANGED
@@ -1,4 +1,3 @@
1
1
  export * from "./constants";
2
- export * as helpers from "./helpers";
3
2
  export * from "./type";
4
3
  export * from "./types";
package/lib/index.js CHANGED
@@ -1,5 +1,3 @@
1
- import { OptionalHelperClass } from "./types.js";
2
1
  import { ARRAY, CUSTOM, OPTIONAL, PARTIAL, PRIMITIVES, PRIMITIVE_OBJECTS, SOA } from "./constants.js";
3
- import { helpers_exports } from "./helpers/index.js";
4
2
  import { type } from "./type.js";
5
- export { ARRAY, CUSTOM, OPTIONAL, OptionalHelperClass, PARTIAL, PRIMITIVES, PRIMITIVE_OBJECTS, SOA, helpers_exports as helpers, type };
3
+ export { ARRAY, CUSTOM, OPTIONAL, PARTIAL, PRIMITIVES, PRIMITIVE_OBJECTS, SOA, type };
package/lib/type.cjs ADDED
@@ -0,0 +1,58 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_constants = require("./constants.cjs");
3
+ const require_helpers_readonly = require("./helpers/readonly.cjs");
4
+ const require_helpers_any = require("./helpers/any.cjs");
5
+ const require_helpers_array = require("./helpers/array.cjs");
6
+ const require_helpers_custom = require("./helpers/custom.cjs");
7
+ const require_helpers_intersection = require("./helpers/intersection.cjs");
8
+ const require_helpers_litterals = require("./helpers/litterals.cjs");
9
+ const require_helpers_optional = require("./helpers/optional.cjs");
10
+ const require_helpers_partial = require("./helpers/partial.cjs");
11
+ const require_helpers_primitive = require("./helpers/primitive.cjs");
12
+ const require_helpers_primitiveObject = require("./helpers/primitiveObject.cjs");
13
+ const require_helpers_record = require("./helpers/record.cjs");
14
+ const require_helpers_soa = require("./helpers/soa.cjs");
15
+ const require_helpers_sv = require("./helpers/sv.cjs");
16
+ const require_helpers_tuple = require("./helpers/tuple.cjs");
17
+ const require_helpers_union = require("./helpers/union.cjs");
18
+ require("./helpers/index.cjs");
19
+ //#region src/type.ts
20
+ const transformTypes = (_) => {};
21
+ const _transform = (obj) => {
22
+ const _obj = obj;
23
+ if (Array.isArray(obj)) return obj.map(_transform);
24
+ if (typeof obj === "object") {
25
+ if ("$$app-ts => optional$$" in _obj) return _transform(_obj[require_constants.OPTIONAL]);
26
+ const isCustom = Object.keys(obj).every((key) => key === require_constants.CUSTOM);
27
+ const out = {};
28
+ if (isCustom) return out;
29
+ Object.entries(obj).filter(([key]) => key !== require_constants.PARTIAL).forEach(([key, value]) => {
30
+ out[key] = _transform(value);
31
+ });
32
+ return out;
33
+ }
34
+ return transformTypes(_obj);
35
+ };
36
+ const type = (option) => {
37
+ if (!option) return void 0;
38
+ if (typeof option === "function") return _transform(option({
39
+ any: require_helpers_any.any,
40
+ custom: require_helpers_custom.custom,
41
+ intersection: require_helpers_intersection.intersection,
42
+ litterals: require_helpers_litterals.litterals,
43
+ optional: require_helpers_optional.optional,
44
+ partial: require_helpers_partial.partial,
45
+ record: require_helpers_record.record,
46
+ soa: require_helpers_soa.soa,
47
+ sv: require_helpers_sv.sv,
48
+ union: require_helpers_union.union,
49
+ array: require_helpers_array.array,
50
+ tuple: require_helpers_tuple.tuple,
51
+ primitiveObject: require_helpers_primitiveObject.primitiveObject,
52
+ primitive: require_helpers_primitive.primitive,
53
+ readonly: require_helpers_readonly.readonly
54
+ }));
55
+ return _transform(option);
56
+ };
57
+ //#endregion
58
+ exports.type = type;
package/lib/type.js ADDED
@@ -0,0 +1,57 @@
1
+ import { CUSTOM, OPTIONAL, PARTIAL } from "./constants.js";
2
+ import { readonly } from "./helpers/readonly.js";
3
+ import { any } from "./helpers/any.js";
4
+ import { array } from "./helpers/array.js";
5
+ import { custom } from "./helpers/custom.js";
6
+ import { intersection } from "./helpers/intersection.js";
7
+ import { litterals } from "./helpers/litterals.js";
8
+ import { optional } from "./helpers/optional.js";
9
+ import { partial } from "./helpers/partial.js";
10
+ import { primitive } from "./helpers/primitive.js";
11
+ import { primitiveObject } from "./helpers/primitiveObject.js";
12
+ import { record } from "./helpers/record.js";
13
+ import { soa } from "./helpers/soa.js";
14
+ import { sv } from "./helpers/sv.js";
15
+ import { tuple } from "./helpers/tuple.js";
16
+ import { union } from "./helpers/union.js";
17
+ import "./helpers/index.js";
18
+ //#region src/type.ts
19
+ const transformTypes = (_) => {};
20
+ const _transform = (obj) => {
21
+ const _obj = obj;
22
+ if (Array.isArray(obj)) return obj.map(_transform);
23
+ if (typeof obj === "object") {
24
+ if ("$$app-ts => optional$$" in _obj) return _transform(_obj[OPTIONAL]);
25
+ const isCustom = Object.keys(obj).every((key) => key === CUSTOM);
26
+ const out = {};
27
+ if (isCustom) return out;
28
+ Object.entries(obj).filter(([key]) => key !== PARTIAL).forEach(([key, value]) => {
29
+ out[key] = _transform(value);
30
+ });
31
+ return out;
32
+ }
33
+ return transformTypes(_obj);
34
+ };
35
+ const type = (option) => {
36
+ if (!option) return void 0;
37
+ if (typeof option === "function") return _transform(option({
38
+ any,
39
+ custom,
40
+ intersection,
41
+ litterals,
42
+ optional,
43
+ partial,
44
+ record,
45
+ soa,
46
+ sv,
47
+ union,
48
+ array,
49
+ tuple,
50
+ primitiveObject,
51
+ primitive,
52
+ readonly
53
+ }));
54
+ return _transform(option);
55
+ };
56
+ //#endregion
57
+ export { type };
@@ -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.cjs ADDED
File without changes
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 | unknown | never;
28
- export type PrimitiveS = (typeof PRIMITIVES)[number];
29
- type TransformPrimitiveS<T extends PrimitiveS> = 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 : T extends "unknown" ? unknown : PrimitiveS;
30
- export type Types = PrimitiveS | (typeof PRIMITIVE_OBJECTS)[number];
31
- export type TransformTypes<T extends Types> = T extends PrimitiveS ? TransformPrimitiveS<T> : T extends "date" ? Date : T extends "any" ? any : object;
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
  };
@@ -48,12 +48,16 @@ export type ArrayCustom<T extends ObjectT = any> = {
48
48
  export type ObjectMapS = {
49
49
  [key: Keys]: SoRa<_ObjectT>;
50
50
  };
51
- export declare class OptionalHelperClass {
51
+ 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
  } & {
package/lib/types.js ADDED
@@ -0,0 +1 @@
1
+ export {};
@@ -9,5 +9,3 @@ const expandFn = (main, extensions) => {
9
9
  };
10
10
  //#endregion
11
11
  exports.expandFn = expandFn;
12
-
13
- //# sourceMappingURL=expandFn.cjs.map
@@ -8,5 +8,3 @@ const expandFn = (main, extensions) => {
8
8
  };
9
9
  //#endregion
10
10
  export { expandFn };
11
-
12
- //# sourceMappingURL=expandFn.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bemedev/typings",
3
- "version": "0.2.1",
3
+ "version": "0.3.0",
4
4
  "description": "Typings by variables",
5
5
  "author": {
6
6
  "email": "bri_lvi@icloud.com",
@@ -16,6 +16,20 @@
16
16
  "main": "lib/index.js",
17
17
  "types": "lib/index.d.ts",
18
18
  "module": "lib/index.js",
19
+ "exports": {
20
+ ".": {
21
+ "import": "./lib/index.js",
22
+ "require": "./lib/index.cjs",
23
+ "types": "./lib/index.d.ts"
24
+ },
25
+ "./helpers": {
26
+ "import": "./lib/helpers/index.js",
27
+ "require": "./lib/helpers/index.cjs",
28
+ "types": "./lib/helpers/index.d.ts"
29
+ },
30
+ "./package.json": "./package.json",
31
+ "./tsconfig.json": "./tsconfig.json"
32
+ },
19
33
  "maintainers": [
20
34
  {
21
35
  "email": "bri_lvi@icloud.com",
@@ -1,13 +0,0 @@
1
- //#region \0rolldown/runtime.js
2
- var __defProp = Object.defineProperty;
3
- var __exportAll = (all, no_symbols) => {
4
- let target = {};
5
- for (var name in all) __defProp(target, name, {
6
- get: all[name],
7
- enumerable: true
8
- });
9
- if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
10
- return target;
11
- };
12
- //#endregion
13
- exports.__exportAll = __exportAll;
@@ -1,13 +0,0 @@
1
- //#region \0rolldown/runtime.js
2
- var __defProp = Object.defineProperty;
3
- var __exportAll = (all, no_symbols) => {
4
- let target = {};
5
- for (var name in all) __defProp(target, name, {
6
- get: all[name],
7
- enumerable: true
8
- });
9
- if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
10
- return target;
11
- };
12
- //#endregion
13
- export { __exportAll };
@@ -1 +0,0 @@
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 \"unknown\",\n \"never\",\n \"primitive\",\n] as const;\n\nexport const PRIMITIVE_OBJECTS = [\"date\", \"any\", \"object\"] 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;CACA;CACD;AAED,MAAa,oBAAoB;CAAC;CAAQ;CAAO;CAAS;AAC1D,MAAa,WAAW;AACxB,MAAa,SAAS;AACtB,MAAa,UAAU;AACvB,MAAa,QAAQ;AACrB,MAAa,MAAM"}
@@ -1 +0,0 @@
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 \"unknown\",\n \"never\",\n \"primitive\",\n] as const;\n\nexport const PRIMITIVE_OBJECTS = [\"date\", \"any\", \"object\"] 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;CACA;CACD;AAED,MAAa,oBAAoB;CAAC;CAAQ;CAAO;CAAS;AAC1D,MAAa,WAAW;AACxB,MAAa,SAAS;AACtB,MAAa,UAAU;AACvB,MAAa,QAAQ;AACrB,MAAa,MAAM"}
@@ -1 +0,0 @@
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) =>\n value as ObjectT extends T ? \"any\" : T;\nexport { any };\n"],"mappings":";;AAEA,MAAM,OAAoC,UACxC"}
@@ -1 +0,0 @@
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) =>\n value as ObjectT extends T ? \"any\" : T;\nexport { any };\n"],"mappings":";AAEA,MAAM,OAAoC,UACxC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"array.cjs","names":["ARRAY"],"sources":["../../src/helpers/array.ts"],"sourcesContent":["import { ARRAY } from \"../constants\";\nimport type { ArrayCustom, NotReadonly, ObjectT } from \"../types\";\n\nconst array = <const T extends ObjectT>(value: T) => {\n type Out = ArrayCustom<Extract<NotReadonly<T>, ObjectT>>;\n\n return { [ARRAY]: value } as Out;\n};\n\nexport { array };\n"],"mappings":";;;AAGA,MAAM,SAAkC,UAAa;AAGnD,QAAO,GAAGA,kBAAAA,QAAQ,OAAO"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"array.js","names":[],"sources":["../../src/helpers/array.ts"],"sourcesContent":["import { ARRAY } from \"../constants\";\nimport type { ArrayCustom, NotReadonly, ObjectT } from \"../types\";\n\nconst array = <const T extends ObjectT>(value: T) => {\n type Out = ArrayCustom<Extract<NotReadonly<T>, ObjectT>>;\n\n return { [ARRAY]: value } as Out;\n};\n\nexport { array };\n"],"mappings":";;AAGA,MAAM,SAAkC,UAAa;AAGnD,QAAO,GAAG,QAAQ,OAAO"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"custom.cjs","names":["CUSTOM"],"sources":["../../src/helpers/custom.ts"],"sourcesContent":["import { CUSTOM } from \"../constants\";\nimport type { Custom } from \"../types\";\n\nconst custom = <T = any>(value?: T) =>\n ({\n [CUSTOM]: value,\n }) as Custom<T>;\n\nexport { custom };\n"],"mappings":";;;AAGA,MAAM,UAAmB,WACtB,GACEA,kBAAAA,SAAS,OACX"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"custom.js","names":[],"sources":["../../src/helpers/custom.ts"],"sourcesContent":["import { CUSTOM } from \"../constants\";\nimport type { Custom } from \"../types\";\n\nconst custom = <T = any>(value?: T) =>\n ({\n [CUSTOM]: value,\n }) as Custom<T>;\n\nexport { custom };\n"],"mappings":";;AAGA,MAAM,UAAmB,WACtB,GACE,SAAS,OACX"}
@@ -1 +0,0 @@
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 \"./record\";\nexport * from \"./soa\";\nexport * from \"./sv\";\nexport * from \"./tuple\";\nexport * from \"./union\";\nexport * from \"./primitiveObject\";\n"],"mappings":""}
@@ -1 +0,0 @@
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 \"./record\";\nexport * from \"./soa\";\nexport * from \"./sv\";\nexport * from \"./tuple\";\nexport * from \"./union\";\nexport * from \"./primitiveObject\";\n"],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"intersection.cjs","names":[],"sources":["../../src/helpers/intersection.ts"],"sourcesContent":["import type { ObjectMapS } from \"../types\";\n\ntype _IntersectionCustom<T extends ObjectMapS[]> = T extends [\n infer First extends ObjectMapS,\n ...infer Rest extends ObjectMapS[],\n]\n ? First & IntersectionCustom<Rest>\n : unknown;\n\nexport type IntersectionCustom<T extends ObjectMapS[]> =\n _IntersectionCustom<T> extends infer R\n ? {\n [K in keyof R]: R[K];\n }\n : never;\n\nconst intersection = <T extends [ObjectMapS, ObjectMapS, ...ObjectMapS[]]>(\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 return out as IntersectionCustom<T>;\n};\n\nexport { intersection };\n"],"mappings":";;AAgBA,MAAM,gBACJ,GAAG,WACA;AAOH,QANY,OAAO,QAAQ,KAAK,SAAS;AACvC,SAAO,QAAQ,KAAK,CAAC,SAAS,CAAC,KAAK,WAAW;AAC7C,OAAI,OAAO;IACX;AACF,SAAO;IACN,EAAE,CAAQ"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"intersection.js","names":[],"sources":["../../src/helpers/intersection.ts"],"sourcesContent":["import type { ObjectMapS } from \"../types\";\n\ntype _IntersectionCustom<T extends ObjectMapS[]> = T extends [\n infer First extends ObjectMapS,\n ...infer Rest extends ObjectMapS[],\n]\n ? First & IntersectionCustom<Rest>\n : unknown;\n\nexport type IntersectionCustom<T extends ObjectMapS[]> =\n _IntersectionCustom<T> extends infer R\n ? {\n [K in keyof R]: R[K];\n }\n : never;\n\nconst intersection = <T extends [ObjectMapS, ObjectMapS, ...ObjectMapS[]]>(\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 return out as IntersectionCustom<T>;\n};\n\nexport { intersection };\n"],"mappings":";AAgBA,MAAM,gBACJ,GAAG,WACA;AAOH,QANY,OAAO,QAAQ,KAAK,SAAS;AACvC,SAAO,QAAQ,KAAK,CAAC,SAAS,CAAC,KAAK,WAAW;AAC7C,OAAI,OAAO;IACX;AACF,SAAO;IACN,EAAE,CAAQ"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"litterals.cjs","names":[],"sources":["../../src/helpers/litterals.ts"],"sourcesContent":["import type { Custom } from \"../types\";\n\nconst litterals = <const T extends (string | number | boolean)[]>(\n ...values: T\n) => values[0] as unknown as Custom<T[number]>;\n\nexport { litterals };\n"],"mappings":";;AAEA,MAAM,aACJ,GAAG,WACA,OAAO"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"litterals.js","names":[],"sources":["../../src/helpers/litterals.ts"],"sourcesContent":["import type { Custom } from \"../types\";\n\nconst litterals = <const T extends (string | number | boolean)[]>(\n ...values: T\n) => values[0] as unknown as Custom<T[number]>;\n\nexport { litterals };\n"],"mappings":";AAEA,MAAM,aACJ,GAAG,WACA,OAAO"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"optional.cjs","names":["OPTIONAL"],"sources":["../../src/helpers/optional.ts"],"sourcesContent":["import { OPTIONAL } from \"../constants\";\nimport type { __ObjectT, AnyArray, ArrayCustom, Optional } from \"../types\";\n\nconst optional = <T extends __ObjectT | ArrayCustom | AnyArray<__ObjectT>>(\n value?: T,\n) =>\n ({\n [OPTIONAL]: value,\n }) as Optional<T>;\n\nexport { optional };\n"],"mappings":";;;AAGA,MAAM,YACJ,WAEC,GACEA,kBAAAA,WAAW,OACb"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"optional.js","names":[],"sources":["../../src/helpers/optional.ts"],"sourcesContent":["import { OPTIONAL } from \"../constants\";\nimport type { __ObjectT, AnyArray, ArrayCustom, Optional } from \"../types\";\n\nconst optional = <T extends __ObjectT | ArrayCustom | AnyArray<__ObjectT>>(\n value?: T,\n) =>\n ({\n [OPTIONAL]: value,\n }) as Optional<T>;\n\nexport { optional };\n"],"mappings":";;AAGA,MAAM,YACJ,WAEC,GACE,WAAW,OACb"}
@@ -1 +0,0 @@
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,WAA8B,UAAgC;CAClE,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"}
@@ -1 +0,0 @@
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,WAA8B,UAAgC;CAClE,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"}
@@ -1 +0,0 @@
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 <const T extends PrimitiveObjectT = PrimitiveObjectT>(\n value?: T,\n ): Exclude<NotReadonly<T>, undefined> => {\n return (value || {}) as any;\n },\n {\n map: <const T extends PrimitiveObjectMapS = PrimitiveObjectMapS>(\n value?: T,\n ): Exclude<NotReadonly<T>, undefined> => {\n return (value || {}) as any;\n },\n },\n);\n\nexport { primitiveObject };\n"],"mappings":";;AAOA,MAAM,mDAAkBA,UAEpB,UACuC;AACvC,QAAQ,SAAS,EAAE;GAErB,EACE,MACE,UACuC;AACvC,QAAQ,SAAS,EAAE;GAEtB,CACF"}
@@ -1 +0,0 @@
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 <const T extends PrimitiveObjectT = PrimitiveObjectT>(\n value?: T,\n ): Exclude<NotReadonly<T>, undefined> => {\n return (value || {}) as any;\n },\n {\n map: <const T extends PrimitiveObjectMapS = PrimitiveObjectMapS>(\n value?: T,\n ): Exclude<NotReadonly<T>, undefined> => {\n return (value || {}) as any;\n },\n },\n);\n\nexport { primitiveObject };\n"],"mappings":";;AAOA,MAAM,kBAAkB,UAEpB,UACuC;AACvC,QAAQ,SAAS,EAAE;GAErB,EACE,MACE,UACuC;AACvC,QAAQ,SAAS,EAAE;GAEtB,CACF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"record.cjs","names":[],"sources":["../../src/helpers/record.ts"],"sourcesContent":["import type { Keys, ObjectT } from \"../types\";\n\nconst record = <const K extends Keys[], V extends ObjectT>(\n value: V,\n ...keys: K\n) => {\n const object = keys.reduce((acc, key) => {\n acc[key] = value;\n return acc;\n }, {} as any);\n\n return object as Record<K[number] extends never ? Keys : K[number], V>;\n};\n\nexport { record };\n"],"mappings":";;AAEA,MAAM,UACJ,OACA,GAAG,SACA;AAMH,QALe,KAAK,QAAQ,KAAK,QAAQ;AACvC,MAAI,OAAO;AACX,SAAO;IACN,EAAE,CAAQ"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"record.js","names":[],"sources":["../../src/helpers/record.ts"],"sourcesContent":["import type { Keys, ObjectT } from \"../types\";\n\nconst record = <const K extends Keys[], V extends ObjectT>(\n value: V,\n ...keys: K\n) => {\n const object = keys.reduce((acc, key) => {\n acc[key] = value;\n return acc;\n }, {} as any);\n\n return object as Record<K[number] extends never ? Keys : K[number], V>;\n};\n\nexport { record };\n"],"mappings":";AAEA,MAAM,UACJ,OACA,GAAG,SACA;AAMH,QALe,KAAK,QAAQ,KAAK,QAAQ;AACvC,MAAI,OAAO;AACX,SAAO;IACN,EAAE,CAAQ"}
@@ -1 +0,0 @@
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 type Out = SoaCustom<Extract<NotReadonly<T>, ObjectT>>;\n return { [SOA]: value } as Out;\n};\n\nexport { soa };\n"],"mappings":";;;AAGA,MAAM,OAAgC,UAAa;AAEjD,QAAO,GAAGA,kBAAAA,MAAM,OAAO"}
@@ -1 +0,0 @@
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 type Out = SoaCustom<Extract<NotReadonly<T>, ObjectT>>;\n return { [SOA]: value } as Out;\n};\n\nexport { soa };\n"],"mappings":";;AAGA,MAAM,OAAgC,UAAa;AAEjD,QAAO,GAAG,MAAM,OAAO"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"sv.cjs","names":[],"sources":["../../src/helpers/sv.ts"],"sourcesContent":["import type { Custom, StateValue } from \"../types\";\n\nconst sv = {} as Custom<StateValue>;\nexport { sv };\n"],"mappings":";;AAEA,MAAM,KAAK,EAAE"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"sv.js","names":[],"sources":["../../src/helpers/sv.ts"],"sourcesContent":["import type { Custom, StateValue } from \"../types\";\n\nconst sv = {} as Custom<StateValue>;\nexport { sv };\n"],"mappings":";AAEA,MAAM,KAAK,EAAE"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"tuple.cjs","names":[],"sources":["../../src/helpers/tuple.ts"],"sourcesContent":["import type { NotReadonly, ObjectT } from \"../types\";\n\nconst tuple = <const T extends [ObjectT, ...ObjectT[]]>(...values: T) =>\n values as NotReadonly<T>;\n\nexport { tuple };\n"],"mappings":";;AAEA,MAAM,SAAkD,GAAG,WACzD"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"tuple.js","names":[],"sources":["../../src/helpers/tuple.ts"],"sourcesContent":["import type { NotReadonly, ObjectT } from \"../types\";\n\nconst tuple = <const T extends [ObjectT, ...ObjectT[]]>(...values: T) =>\n values as NotReadonly<T>;\n\nexport { tuple };\n"],"mappings":";AAEA,MAAM,SAAkD,GAAG,WACzD"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"union.cjs","names":["expandFn"],"sources":["../../src/helpers/union.ts"],"sourcesContent":["import type { Keys, ObjectMapS, ObjectT } from \"../types\";\nimport { expandFn } from \"../utils/expandFn\";\n\nconst _union = <T extends [ObjectT, ObjectT, ...ObjectT[]]>(...values: T) => {\n return values[0] as T[number];\n};\n\ntype Discriminated<K extends Keys> = ObjectMapS & Record<K, ObjectT>;\n\nconst union = expandFn(_union, {\n discriminated: <\n const K extends Keys,\n T extends [Discriminated<K>, Discriminated<K>, ...Discriminated<K>[]],\n >(\n _key: K,\n ...values: T\n ) => _union(...values),\n});\n\nexport { union };\n"],"mappings":";;;AAGA,MAAM,UAAsD,GAAG,WAAc;AAC3E,QAAO,OAAO;;AAKhB,MAAM,QAAQA,uBAAAA,SAAS,QAAQ,EAC7B,gBAIE,MACA,GAAG,WACA,OAAO,GAAG,OAAO,EACvB,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"union.js","names":[],"sources":["../../src/helpers/union.ts"],"sourcesContent":["import type { Keys, ObjectMapS, ObjectT } from \"../types\";\nimport { expandFn } from \"../utils/expandFn\";\n\nconst _union = <T extends [ObjectT, ObjectT, ...ObjectT[]]>(...values: T) => {\n return values[0] as T[number];\n};\n\ntype Discriminated<K extends Keys> = ObjectMapS & Record<K, ObjectT>;\n\nconst union = expandFn(_union, {\n discriminated: <\n const K extends Keys,\n T extends [Discriminated<K>, Discriminated<K>, ...Discriminated<K>[]],\n >(\n _key: K,\n ...values: T\n ) => _union(...values),\n});\n\nexport { union };\n"],"mappings":";;AAGA,MAAM,UAAsD,GAAG,WAAc;AAC3E,QAAO,OAAO;;AAKhB,MAAM,QAAQ,SAAS,QAAQ,EAC7B,gBAIE,MACA,GAAG,WACA,OAAO,GAAG,OAAO,EACvB,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"expandFn.cjs","names":[],"sources":["../../src/utils/expandFn.ts"],"sourcesContent":["import type { Fn, FnBasic } from \"../types\";\n\nexport const expandFn = <Main extends Fn, const Tr extends object = object>(\n main: Main,\n extensions?: Tr,\n): FnBasic<Main, Tr> => {\n const out: any = main;\n\n /* v8 ignore start -- @preserve */\n if (extensions) Object.assign(out, extensions);\n /* v8 ignore stop -- @preserve */\n\n return out;\n};\n"],"mappings":";;AAEA,MAAa,YACX,MACA,eACsB;CACtB,MAAM,MAAW;;AAGjB,KAAI,WAAY,QAAO,OAAO,KAAK,WAAW;;AAG9C,QAAO"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"expandFn.js","names":[],"sources":["../../src/utils/expandFn.ts"],"sourcesContent":["import type { Fn, FnBasic } from \"../types\";\n\nexport const expandFn = <Main extends Fn, const Tr extends object = object>(\n main: Main,\n extensions?: Tr,\n): FnBasic<Main, Tr> => {\n const out: any = main;\n\n /* v8 ignore start -- @preserve */\n if (extensions) Object.assign(out, extensions);\n /* v8 ignore stop -- @preserve */\n\n return out;\n};\n"],"mappings":";AAEA,MAAa,YACX,MACA,eACsB;CACtB,MAAM,MAAW;;AAGjB,KAAI,WAAY,QAAO,OAAO,KAAK,WAAW;;AAG9C,QAAO"}