@stryke/types 0.10.22 → 0.10.24

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 (163) hide show
  1. package/dist/array.d.cts +122 -2
  2. package/dist/array.d.cts.map +1 -0
  3. package/dist/array.d.mts +122 -2
  4. package/dist/array.d.mts.map +1 -0
  5. package/dist/async.d.cts +111 -2
  6. package/dist/async.d.cts.map +1 -0
  7. package/dist/async.d.mts +111 -2
  8. package/dist/async.d.mts.map +1 -0
  9. package/dist/base.cjs +3 -1
  10. package/dist/base.d.cts +331 -2
  11. package/dist/base.d.cts.map +1 -0
  12. package/dist/base.d.mts +331 -2
  13. package/dist/base.d.mts.map +1 -0
  14. package/dist/base.mjs +3 -1
  15. package/dist/base.mjs.map +1 -0
  16. package/dist/configuration.d.cts +71 -2
  17. package/dist/configuration.d.cts.map +1 -0
  18. package/dist/configuration.d.mts +71 -2
  19. package/dist/configuration.d.mts.map +1 -0
  20. package/dist/file.d.cts +51 -2
  21. package/dist/file.d.cts.map +1 -0
  22. package/dist/file.d.mts +51 -2
  23. package/dist/file.d.mts.map +1 -0
  24. package/dist/form.d.cts +40 -2
  25. package/dist/form.d.cts.map +1 -0
  26. package/dist/form.d.mts +40 -2
  27. package/dist/form.d.mts.map +1 -0
  28. package/dist/index.cjs +1 -1
  29. package/dist/index.d.cts +19 -18
  30. package/dist/index.d.mts +19 -18
  31. package/dist/index.mjs +1 -1
  32. package/dist/json.d.cts +70 -2
  33. package/dist/json.d.cts.map +1 -0
  34. package/dist/json.d.mts +70 -2
  35. package/dist/json.d.mts.map +1 -0
  36. package/dist/logic.d.cts +124 -2
  37. package/dist/logic.d.cts.map +1 -0
  38. package/dist/logic.d.mts +124 -2
  39. package/dist/logic.d.mts.map +1 -0
  40. package/dist/messages.d.cts +21 -2
  41. package/dist/messages.d.cts.map +1 -0
  42. package/dist/messages.d.mts +21 -2
  43. package/dist/messages.d.mts.map +1 -0
  44. package/dist/navigator.d.cts +42 -2
  45. package/dist/navigator.d.cts.map +1 -0
  46. package/dist/navigator.d.mts +42 -2
  47. package/dist/navigator.d.mts.map +1 -0
  48. package/dist/number.d.cts +181 -2
  49. package/dist/number.d.cts.map +1 -0
  50. package/dist/number.d.mts +181 -2
  51. package/dist/number.d.mts.map +1 -0
  52. package/dist/object.d.cts +394 -2
  53. package/dist/object.d.cts.map +1 -0
  54. package/dist/object.d.mts +394 -2
  55. package/dist/object.d.mts.map +1 -0
  56. package/dist/package-json.d.cts +261 -2
  57. package/dist/package-json.d.cts.map +1 -0
  58. package/dist/package-json.d.mts +261 -2
  59. package/dist/package-json.d.mts.map +1 -0
  60. package/dist/package-manager.d.cts +6 -2
  61. package/dist/package-manager.d.cts.map +1 -0
  62. package/dist/package-manager.d.mts +6 -2
  63. package/dist/package-manager.d.mts.map +1 -0
  64. package/dist/string.d.cts +81 -2
  65. package/dist/string.d.cts.map +1 -0
  66. package/dist/string.d.mts +81 -2
  67. package/dist/string.d.mts.map +1 -0
  68. package/dist/system.d.cts +5 -2
  69. package/dist/system.d.cts.map +1 -0
  70. package/dist/system.d.mts +5 -2
  71. package/dist/system.d.mts.map +1 -0
  72. package/dist/tsconfig.d.cts +803 -2
  73. package/dist/tsconfig.d.cts.map +1 -0
  74. package/dist/tsconfig.d.mts +803 -2
  75. package/dist/tsconfig.d.mts.map +1 -0
  76. package/dist/user.d.cts +29 -2
  77. package/dist/user.d.cts.map +1 -0
  78. package/dist/user.d.mts +29 -2
  79. package/dist/user.d.mts.map +1 -0
  80. package/dist/utilities.d.cts +51 -2
  81. package/dist/utilities.d.cts.map +1 -0
  82. package/dist/utilities.d.mts +51 -2
  83. package/dist/utilities.d.mts.map +1 -0
  84. package/dist/validations.d.cts +21 -2
  85. package/dist/validations.d.cts.map +1 -0
  86. package/dist/validations.d.mts +21 -2
  87. package/dist/validations.d.mts.map +1 -0
  88. package/package.json +3 -3
  89. package/dist/array-DVtfX_TI.d.mts +0 -122
  90. package/dist/array-DVtfX_TI.d.mts.map +0 -1
  91. package/dist/array-DtIKbcDr.d.cts +0 -122
  92. package/dist/array-DtIKbcDr.d.cts.map +0 -1
  93. package/dist/async-BtPWg6IL.d.mts +0 -111
  94. package/dist/async-BtPWg6IL.d.mts.map +0 -1
  95. package/dist/async-eKWh-_sF.d.cts +0 -111
  96. package/dist/async-eKWh-_sF.d.cts.map +0 -1
  97. package/dist/base-CiIyKS-b.d.mts +0 -331
  98. package/dist/base-CiIyKS-b.d.mts.map +0 -1
  99. package/dist/base-Cpeh4C5c.cjs +0 -3
  100. package/dist/base-DmFPRVSE.mjs +0 -3
  101. package/dist/base-DmFPRVSE.mjs.map +0 -1
  102. package/dist/base-EF17pdAI.d.cts +0 -331
  103. package/dist/base-EF17pdAI.d.cts.map +0 -1
  104. package/dist/configuration-5Q2wg3Id.d.mts +0 -71
  105. package/dist/configuration-5Q2wg3Id.d.mts.map +0 -1
  106. package/dist/configuration-Dvz7q6dd.d.cts +0 -71
  107. package/dist/configuration-Dvz7q6dd.d.cts.map +0 -1
  108. package/dist/file-dM8RAMNC.d.cts +0 -51
  109. package/dist/file-dM8RAMNC.d.cts.map +0 -1
  110. package/dist/file-eWushyiM.d.mts +0 -51
  111. package/dist/file-eWushyiM.d.mts.map +0 -1
  112. package/dist/form-mTzpZCeA.d.cts +0 -40
  113. package/dist/form-mTzpZCeA.d.cts.map +0 -1
  114. package/dist/form-sNCVXIEk.d.mts +0 -40
  115. package/dist/form-sNCVXIEk.d.mts.map +0 -1
  116. package/dist/json-BlaU0Pbq.d.cts +0 -70
  117. package/dist/json-BlaU0Pbq.d.cts.map +0 -1
  118. package/dist/json-C3wqh2t3.d.mts +0 -70
  119. package/dist/json-C3wqh2t3.d.mts.map +0 -1
  120. package/dist/logic-BoEG5A3-.d.cts +0 -374
  121. package/dist/logic-BoEG5A3-.d.cts.map +0 -1
  122. package/dist/logic-h9Jrrpsk.d.mts +0 -374
  123. package/dist/logic-h9Jrrpsk.d.mts.map +0 -1
  124. package/dist/messages-Bxu_o13x.d.mts +0 -21
  125. package/dist/messages-Bxu_o13x.d.mts.map +0 -1
  126. package/dist/messages-PtLJRJeN.d.cts +0 -21
  127. package/dist/messages-PtLJRJeN.d.cts.map +0 -1
  128. package/dist/navigator-DLpMW73v.d.mts +0 -42
  129. package/dist/navigator-DLpMW73v.d.mts.map +0 -1
  130. package/dist/navigator-wsxMUGqK.d.cts +0 -42
  131. package/dist/navigator-wsxMUGqK.d.cts.map +0 -1
  132. package/dist/object-B3Rc0f80.d.mts +0 -392
  133. package/dist/object-B3Rc0f80.d.mts.map +0 -1
  134. package/dist/object-DyLgFijN.d.cts +0 -392
  135. package/dist/object-DyLgFijN.d.cts.map +0 -1
  136. package/dist/package-json-BYMmXu4B.d.mts +0 -261
  137. package/dist/package-json-BYMmXu4B.d.mts.map +0 -1
  138. package/dist/package-json-DMeUqEmW.d.cts +0 -261
  139. package/dist/package-json-DMeUqEmW.d.cts.map +0 -1
  140. package/dist/package-manager-PRcovqs-.d.mts +0 -6
  141. package/dist/package-manager-PRcovqs-.d.mts.map +0 -1
  142. package/dist/package-manager-tcG2TLVT.d.cts +0 -6
  143. package/dist/package-manager-tcG2TLVT.d.cts.map +0 -1
  144. package/dist/system-BxYi2_rE.d.mts +0 -5
  145. package/dist/system-BxYi2_rE.d.mts.map +0 -1
  146. package/dist/system-n1LPjzuJ.d.cts +0 -5
  147. package/dist/system-n1LPjzuJ.d.cts.map +0 -1
  148. package/dist/tsconfig-C6dWY2RO.d.cts +0 -803
  149. package/dist/tsconfig-C6dWY2RO.d.cts.map +0 -1
  150. package/dist/tsconfig-CUKA7cEN.d.mts +0 -803
  151. package/dist/tsconfig-CUKA7cEN.d.mts.map +0 -1
  152. package/dist/user-CkdO4wnf.d.mts +0 -29
  153. package/dist/user-CkdO4wnf.d.mts.map +0 -1
  154. package/dist/user-CovHR6Ne.d.cts +0 -29
  155. package/dist/user-CovHR6Ne.d.cts.map +0 -1
  156. package/dist/utilities-BVS-gcgS.d.mts +0 -51
  157. package/dist/utilities-BVS-gcgS.d.mts.map +0 -1
  158. package/dist/utilities-Jb4ggdM-.d.cts +0 -51
  159. package/dist/utilities-Jb4ggdM-.d.cts.map +0 -1
  160. package/dist/validations-C_7osVpS.d.mts +0 -21
  161. package/dist/validations-C_7osVpS.d.mts.map +0 -1
  162. package/dist/validations-CvwxY4RE.d.cts +0 -21
  163. package/dist/validations-CvwxY4RE.d.cts.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tsconfig.d.mts","names":[],"sources":["../src/tsconfig.ts"],"sourcesContent":[],"mappings":";;;KAoBY,GAAA;KAOA,MAAA;AAPA,KAoCA,OAAA,GApCG,MAAA,GAAA,IAAA,GAAA,MAAA,GAAA,IAAA;AAOH,KAoCA,MAAA,GApCM,KAAA,GAAA,KAAA,GAAA,KAAA,GAAA,QAAA,GAAA,QAAA,GAAA,QAAA,GAAA,QAAA,GAAA,QAAA,GAAA,QAAA,GAAA,QAAA,GAAA,QAAA,GAAA,QAAA,GAAA,KAAA,GAAA,KAAA,GAAA,KAAA,GAAA,QAAA,GAAA,QAAA,GAAA,QAAA,GAAA,QAAA,GAAA,QAAA,GAAA,QAAA,GAAA,QAAA,GAAA,QAAA,GAAA,QAAA;AA6BN,KAkCA,GAAA,GAlCO,KAAA,GAAA,KAAA,GAAA,KAAA,GAAA,QAAA,GAAA,mBAAA,GAAA,aAAA,GAAA,kBAAA,GAAA,iBAAA,GAAA,gBAAA,GAAA,cAAA,GAAA,gBAAA,GAAA,yBAAA,GAAA,eAAA,GAAA,QAAA,GAAA,sBAAA,GAAA,QAAA,GAAA,aAAA,GAAA,eAAA,GAAA,qBAAA,GAAA,eAAA,GAAA,oBAAA,GAAA,QAAA,GAAA,uBAAA,GAAA,sBAAA,GAAA,aAAA,GAAA,gBAAA,GAAA,eAAA,GAAA,QAAA,GAAA,cAAA,GAAA,eAAA,GAAA,eAAA,GAAA,eAAA,GAAA,QAAA,GAAA,eAAA,GAAA,gBAAA,GAAA,e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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;WAsLD;;;;;;;;;;;;;;;;;;;oBAsBS;;;;;;;mBAQD;;;;;;;cAQL;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAgFJ;;;;YAKE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAsEJ;;;;;;;;;;;;;;;;;;;;;;;;;2BA6BmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oBA0JP;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uBA6CG;;KAGX,aAAA;KAQA,kBAAA;KAMA,gBAAA;UAMK,YAAA;;;;;;cAMH,gBAAgB,UAAU;;;;;;mBAOrB,qBAAqB,UAAU;;;;oBAK9B,mBAAmB,UAAU;;;;;;;;;;;;;;;;;UAqBhC,eAAA;;;;;;;;;;;;;;UAiBA,UAAA;;;;;;;;;;;;;;;;;;;;;;;;UA4BA,YAAA;;;;oBAIG;;;;iBAKH;;;;oBAKG;;;;;;;;;;;;;;;;;;;;;;YA2BR;;;;;;YAOA;;;;eAKG"}
package/dist/user.d.cts CHANGED
@@ -1,2 +1,29 @@
1
- import { n as UserType, t as UserBase } from "./user-CovHR6Ne.cjs";
2
- export { UserBase, UserType };
1
+ //#region src/user.d.ts
2
+ type UserType = "external" | "internal" | "service" | "admin";
3
+ interface UserBase {
4
+ /**
5
+ * The user's ID.
6
+ */
7
+ id: string;
8
+ /**
9
+ * The user's full name.
10
+ */
11
+ username?: string;
12
+ /**
13
+ * The user's type.
14
+ *
15
+ * @defaultValue "external"
16
+ */
17
+ type: UserType;
18
+ /**
19
+ * The user's email address.
20
+ */
21
+ email?: string;
22
+ /**
23
+ * The user's role.
24
+ */
25
+ role?: string;
26
+ }
27
+ //#endregion
28
+ export { UserBase, UserType };
29
+ //# sourceMappingURL=user.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user.d.cts","names":[],"sources":["../src/user.ts"],"sourcesContent":[],"mappings":";KAkBY,QAAA;AAAA,UAEK,QAAA,CAFG;EAEH;;;;;;;;;;;;;QAgBT"}
package/dist/user.d.mts CHANGED
@@ -1,2 +1,29 @@
1
- import { n as UserType, t as UserBase } from "./user-CkdO4wnf.mjs";
2
- export { UserBase, UserType };
1
+ //#region src/user.d.ts
2
+ type UserType = "external" | "internal" | "service" | "admin";
3
+ interface UserBase {
4
+ /**
5
+ * The user's ID.
6
+ */
7
+ id: string;
8
+ /**
9
+ * The user's full name.
10
+ */
11
+ username?: string;
12
+ /**
13
+ * The user's type.
14
+ *
15
+ * @defaultValue "external"
16
+ */
17
+ type: UserType;
18
+ /**
19
+ * The user's email address.
20
+ */
21
+ email?: string;
22
+ /**
23
+ * The user's role.
24
+ */
25
+ role?: string;
26
+ }
27
+ //#endregion
28
+ export { UserBase, UserType };
29
+ //# sourceMappingURL=user.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user.d.mts","names":[],"sources":["../src/user.ts"],"sourcesContent":[],"mappings":";KAkBY,QAAA;AAAA,UAEK,QAAA,CAFG;EAEH;;;;;;;;;;;;;QAgBT"}
@@ -1,2 +1,51 @@
1
- import { a as DeepReadonlyObject, c as NameValuePair, d as Nullable, f as Pretty, i as DeepReadonlyArray, l as Narrow, m as Try, n as ComputeRange, o as Index40, p as RequiredByKey, r as DeepReadonly, s as IsNullable, t as Cast, u as NoInfer } from "./utilities-Jb4ggdM-.cjs";
2
- export { Cast, ComputeRange, DeepReadonly, DeepReadonlyArray, DeepReadonlyObject, Index40, IsNullable, NameValuePair, Narrow, NoInfer, Nullable, Pretty, RequiredByKey, Try };
1
+ import { Primitive } from "./base.cjs";
2
+
3
+ //#region src/utilities.d.ts
4
+ type Nullable<T> = T | null;
5
+ type IsNullable<T> = [null] extends [T] ? true : false;
6
+ type RequiredByKey<T, K$1 extends keyof T> = Omit<T, K$1> & Required<Pick<T, K$1>>;
7
+ type NoInfer<T> = [T][T extends any ? 0 : never];
8
+ type Narrowable = string | number | bigint | boolean;
9
+ type NarrowRaw<A> = (A extends [] ? [] : never) | (A extends Narrowable ? A : never) | { [K in keyof A]: A[K] extends Function ? A[K] : NarrowRaw<A[K]> };
10
+ type Narrow<A> = Try<A, [], NarrowRaw<A>>;
11
+ type Try<A1, A2, Catch = never> = A1 extends A2 ? A1 : Catch;
12
+ type Pretty<T> = { [K in keyof T]: T[K] } & {};
13
+ type ComputeRange<N extends number, Result extends unknown[] = []> = Result["length"] extends N ? Result : ComputeRange<N, [...Result, Result["length"]]>;
14
+ type Index40 = ComputeRange<40>[number];
15
+ /**
16
+ * A utility type for specifying a name/value pair.
17
+ */
18
+ interface NameValuePair<TValue, TName = string> {
19
+ /**
20
+ * The name of the pair
21
+ */
22
+ name: TName;
23
+ /**
24
+ * The value of the pair
25
+ */
26
+ value: TValue;
27
+ }
28
+ /**
29
+ * Ask TS to re-check that `A1` extends `A2`.
30
+ * And if it fails, `A2` will be enforced anyway.
31
+ * Can also be used to add constraints on parameters.
32
+ *
33
+ * @example
34
+ * ```ts
35
+ * import { Cast } from '@stryke/types'
36
+ *
37
+ * type test0 = Cast<'42', string> // '42'
38
+ * type test1 = Cast<'42', number> // number
39
+ * ```
40
+ *
41
+ * @param A1 - to check against
42
+ * @param A2 - to cast to
43
+ * @returns `A1 | A2`
44
+ */
45
+ type Cast<A1, A2> = A1 extends A2 ? A1 : A2;
46
+ type DeepReadonly<T> = T extends Primitive ? T : T extends Array<infer U> ? DeepReadonlyArray<U> : DeepReadonlyObject<T>;
47
+ type DeepReadonlyArray<T> = ReadonlyArray<DeepReadonly<T>>;
48
+ type DeepReadonlyObject<T> = { readonly [K in keyof T]: DeepReadonly<T[K]> };
49
+ //#endregion
50
+ export { Cast, ComputeRange, DeepReadonly, DeepReadonlyArray, DeepReadonlyObject, Index40, IsNullable, NameValuePair, Narrow, NoInfer, Nullable, Pretty, RequiredByKey, Try };
51
+ //# sourceMappingURL=utilities.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utilities.d.cts","names":[],"sources":["../src/utilities.ts"],"sourcesContent":[],"mappings":";;;KAoBY,cAAc;KACd,gCAAgC;AADhC,KAGA,aAHQ,CAAA,CAAA,EAAM,YAAC,MAGkB,CAHlB,CAAA,GAGuB,IAHvB,CAG4B,CAH5B,EAG+B,GAH/B,CAAA,GAIzB,QAJyB,CAIhB,IAJgB,CAIX,CAJW,EAIR,GAJQ,CAAA,CAAA;AACf,KAKA,OALU,CAAA,CAAA,CAAA,GAAA,CAKI,CALJ,CAAA,CAKO,CALP,SAAuB,GAAA,GAAA,CAAA,GAAA,KAAA,CAAA;AAE7C,KAKK,UAAA,GALO,MAAa,GAAA,MAAA,GAAA,MAAA,GAAA,OAAA;KAOpB,SAPwC,CAAA,CAAA,CAAA,GAAA,CAQxC,CARwC,SAAA,EAAA,GAAA,EAAA,GAAA,KAAA,CAAA,GAAA,CASxC,CATwC,SAS9B,UAT8B,GASjB,CATiB,GAAA,KAAA,CAAA,GAAA,QAAU,MAYrC,CAZqC,GAYjC,CAZiC,CAY/B,CAZ+B,CAAA,SAYpB,QAZoB,GAYT,CAZS,CAYP,CAZO,CAAA,GAYF,SAZE,CAYQ,CAZR,CAYU,CAZV,CAAA,CAAA,EAAG;AAAR,KAetC,MAfsC,CAAA,CAAA,CAAA,GAe1B,GAf0B,CAetB,CAfsB,EAAA,EAAA,EAef,SAfe,CAeL,CAfK,CAAA,CAAA;AAClC,KAgBJ,GAhBI,CAAA,EAAA,EAAA,EAAA,EAAA,QAAA,KAAA,CAAA,GAgByB,EAhBzB,SAgBoC,EAhBpC,GAgByC,EAhBzC,GAgB8C,KAhB9C;AAAG,KAmBP,MAnBO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{ a as DeepReadonlyObject, c as NameValuePair, d as Nullable, f as Pretty, i as DeepReadonlyArray, l as Narrow, m as Try, n as ComputeRange, o as Index40, p as RequiredByKey, r as DeepReadonly, s as IsNullable, t as Cast, u as NoInfer } from "./utilities-BVS-gcgS.mjs";
2
- export { Cast, ComputeRange, DeepReadonly, DeepReadonlyArray, DeepReadonlyObject, Index40, IsNullable, NameValuePair, Narrow, NoInfer, Nullable, Pretty, RequiredByKey, Try };
1
+ import { Primitive } from "./base.mjs";
2
+
3
+ //#region src/utilities.d.ts
4
+ type Nullable<T> = T | null;
5
+ type IsNullable<T> = [null] extends [T] ? true : false;
6
+ type RequiredByKey<T, K$1 extends keyof T> = Omit<T, K$1> & Required<Pick<T, K$1>>;
7
+ type NoInfer<T> = [T][T extends any ? 0 : never];
8
+ type Narrowable = string | number | bigint | boolean;
9
+ type NarrowRaw<A> = (A extends [] ? [] : never) | (A extends Narrowable ? A : never) | { [K in keyof A]: A[K] extends Function ? A[K] : NarrowRaw<A[K]> };
10
+ type Narrow<A> = Try<A, [], NarrowRaw<A>>;
11
+ type Try<A1, A2, Catch = never> = A1 extends A2 ? A1 : Catch;
12
+ type Pretty<T> = { [K in keyof T]: T[K] } & {};
13
+ type ComputeRange<N extends number, Result extends unknown[] = []> = Result["length"] extends N ? Result : ComputeRange<N, [...Result, Result["length"]]>;
14
+ type Index40 = ComputeRange<40>[number];
15
+ /**
16
+ * A utility type for specifying a name/value pair.
17
+ */
18
+ interface NameValuePair<TValue, TName = string> {
19
+ /**
20
+ * The name of the pair
21
+ */
22
+ name: TName;
23
+ /**
24
+ * The value of the pair
25
+ */
26
+ value: TValue;
27
+ }
28
+ /**
29
+ * Ask TS to re-check that `A1` extends `A2`.
30
+ * And if it fails, `A2` will be enforced anyway.
31
+ * Can also be used to add constraints on parameters.
32
+ *
33
+ * @example
34
+ * ```ts
35
+ * import { Cast } from '@stryke/types'
36
+ *
37
+ * type test0 = Cast<'42', string> // '42'
38
+ * type test1 = Cast<'42', number> // number
39
+ * ```
40
+ *
41
+ * @param A1 - to check against
42
+ * @param A2 - to cast to
43
+ * @returns `A1 | A2`
44
+ */
45
+ type Cast<A1, A2> = A1 extends A2 ? A1 : A2;
46
+ type DeepReadonly<T> = T extends Primitive ? T : T extends Array<infer U> ? DeepReadonlyArray<U> : DeepReadonlyObject<T>;
47
+ type DeepReadonlyArray<T> = ReadonlyArray<DeepReadonly<T>>;
48
+ type DeepReadonlyObject<T> = { readonly [K in keyof T]: DeepReadonly<T[K]> };
49
+ //#endregion
50
+ export { Cast, ComputeRange, DeepReadonly, DeepReadonlyArray, DeepReadonlyObject, Index40, IsNullable, NameValuePair, Narrow, NoInfer, Nullable, Pretty, RequiredByKey, Try };
51
+ //# sourceMappingURL=utilities.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utilities.d.mts","names":[],"sources":["../src/utilities.ts"],"sourcesContent":[],"mappings":";;;KAoBY,cAAc;KACd,gCAAgC;AADhC,KAGA,aAHQ,CAAA,CAAA,EAAM,YAAC,MAGkB,CAHlB,CAAA,GAGuB,IAHvB,CAG4B,CAH5B,EAG+B,GAH/B,CAAA,GAIzB,QAJyB,CAIhB,IAJgB,CAIX,CAJW,EAIR,GAJQ,CAAA,CAAA;AACf,KAKA,OALU,CAAA,CAAA,CAAA,GAAA,CAKI,CALJ,CAAA,CAKO,CALP,SAAuB,GAAA,GAAA,CAAA,GAAA,KAAA,CAAA;AAE7C,KAKK,UAAA,GALO,MAAa,GAAA,MAAA,GAAA,MAAA,GAAA,OAAA;KAOpB,SAPwC,CAAA,CAAA,CAAA,GAAA,CAQxC,CARwC,SAAA,EAAA,GAAA,EAAA,GAAA,KAAA,CAAA,GAAA,CASxC,CATwC,SAS9B,UAT8B,GASjB,CATiB,GAAA,KAAA,CAAA,GAAA,QAAU,MAYrC,CAZqC,GAYjC,CAZiC,CAY/B,CAZ+B,CAAA,SAYpB,QAZoB,GAYT,CAZS,CAYP,CAZO,CAAA,GAYF,SAZE,CAYQ,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mDtC,kBAnDsC,CAmDnB,CAnDmB,CAAA;AAAC,KAqDjC,iBArDiC,CAAA,CAAA,CAAA,GAqDV,aArDU,CAqDI,YArDJ,CAqDiB,CArDjB,CAAA,CAAA;AAEjC,KAqDA,kBArDY,CAAA,CAAA,CAAA,GAAA,iBAGpB,MAmDmB,CAnDnB,GAmDuB,YAnDvB,CAmDoC,CAnDpC,CAmDsC,CAnDtC,CAAA,CAAA,EAAyB"}
@@ -1,2 +1,21 @@
1
- import { a as SuccessValidationDetail, i as InfoValidationDetail, n as HelpValidationDetail, o as ValidationDetail, r as InferValidationType, s as WarningValidationDetail, t as ErrorValidationDetail } from "./validations-CvwxY4RE.cjs";
2
- export { ErrorValidationDetail, HelpValidationDetail, InferValidationType, InfoValidationDetail, SuccessValidationDetail, ValidationDetail, WarningValidationDetail };
1
+ import { MessageDetails, MessageType } from "./messages.cjs";
2
+
3
+ //#region src/validations.d.ts
4
+ type ValidationDetail<TMessageType extends MessageType = MessageType> = MessageDetails<TMessageType> & {
5
+ /**
6
+ * The field path that the message is related to.
7
+ *
8
+ * @remarks
9
+ * If `undefined` or `null`, the message is not related to a specific field - in this case it is likely a global/form message.
10
+ */
11
+ path?: string | null;
12
+ };
13
+ type ErrorValidationDetail = ValidationDetail<"error">;
14
+ type WarningValidationDetail = ValidationDetail<"warning">;
15
+ type InfoValidationDetail = ValidationDetail<"info">;
16
+ type HelpValidationDetail = ValidationDetail<"help">;
17
+ type SuccessValidationDetail = ValidationDetail<"success">;
18
+ type InferValidationType<TMessageType extends MessageType> = TMessageType extends "error" ? ErrorValidationDetail : TMessageType extends "warning" ? WarningValidationDetail : TMessageType extends "help" ? InfoValidationDetail : TMessageType extends "info" ? SuccessValidationDetail : ValidationDetail;
19
+ //#endregion
20
+ export { ErrorValidationDetail, HelpValidationDetail, InferValidationType, InfoValidationDetail, SuccessValidationDetail, ValidationDetail, WarningValidationDetail };
21
+ //# sourceMappingURL=validations.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validations.d.cts","names":[],"sources":["../src/validations.ts"],"sourcesContent":[],"mappings":";;;KAoBY,sCAAsC,cAAc,eAC9D,eAAe;;AADjB;;;;;EACgB,IAAA,CAAA,EAAA,MAAA,GAAA,IAAA;AAUhB,CAAA;AACY,KADA,qBAAA,GAAwB,gBACE,CAAA,OAAgB,CAAA;AAC1C,KADA,uBAAA,GAA0B,gBACH,CAAA,SAAgB,CAAA;AACvC,KADA,oBAAA,GAAuB,gBACA,CAAA,MAAgB,CAAA;AACvC,KADA,oBAAA,GAAuB,gBACG,CAAA,MAAA,CAAA;AAE1B,KAFA,uBAAA,GAA0B,gBAEP,CAAA,SAAA,CAAA;AAAsB,KAAzC,mBAAyC,CAAA,qBAAA,WAAA,CAAA,GACnD,YADmD,SAAA,OAAA,GAE/C,qBAF+C,GAG/C,YAH+C,SAAA,SAAA,GAI7C,uBAJ6C,GAK7C,YAL6C,SAAA,MAAA,GAM3C,oBAN2C,GAO3C,YAP2C,SAAA,MAAA,GAQzC,uBARyC,GASzC,gBATyC"}
@@ -1,2 +1,21 @@
1
- import { a as SuccessValidationDetail, i as InfoValidationDetail, n as HelpValidationDetail, o as ValidationDetail, r as InferValidationType, s as WarningValidationDetail, t as ErrorValidationDetail } from "./validations-C_7osVpS.mjs";
2
- export { ErrorValidationDetail, HelpValidationDetail, InferValidationType, InfoValidationDetail, SuccessValidationDetail, ValidationDetail, WarningValidationDetail };
1
+ import { MessageDetails, MessageType } from "./messages.mjs";
2
+
3
+ //#region src/validations.d.ts
4
+ type ValidationDetail<TMessageType extends MessageType = MessageType> = MessageDetails<TMessageType> & {
5
+ /**
6
+ * The field path that the message is related to.
7
+ *
8
+ * @remarks
9
+ * If `undefined` or `null`, the message is not related to a specific field - in this case it is likely a global/form message.
10
+ */
11
+ path?: string | null;
12
+ };
13
+ type ErrorValidationDetail = ValidationDetail<"error">;
14
+ type WarningValidationDetail = ValidationDetail<"warning">;
15
+ type InfoValidationDetail = ValidationDetail<"info">;
16
+ type HelpValidationDetail = ValidationDetail<"help">;
17
+ type SuccessValidationDetail = ValidationDetail<"success">;
18
+ type InferValidationType<TMessageType extends MessageType> = TMessageType extends "error" ? ErrorValidationDetail : TMessageType extends "warning" ? WarningValidationDetail : TMessageType extends "help" ? InfoValidationDetail : TMessageType extends "info" ? SuccessValidationDetail : ValidationDetail;
19
+ //#endregion
20
+ export { ErrorValidationDetail, HelpValidationDetail, InferValidationType, InfoValidationDetail, SuccessValidationDetail, ValidationDetail, WarningValidationDetail };
21
+ //# sourceMappingURL=validations.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validations.d.mts","names":[],"sources":["../src/validations.ts"],"sourcesContent":[],"mappings":";;;KAoBY,sCAAsC,cAAc,eAC9D,eAAe;;AADjB;;;;;EACgB,IAAA,CAAA,EAAA,MAAA,GAAA,IAAA;AAUhB,CAAA;AACY,KADA,qBAAA,GAAwB,gBACE,CAAA,OAAgB,CAAA;AAC1C,KADA,uBAAA,GAA0B,gBACH,CAAA,SAAgB,CAAA;AACvC,KADA,oBAAA,GAAuB,gBACA,CAAA,MAAgB,CAAA;AACvC,KADA,oBAAA,GAAuB,gBACG,CAAA,MAAA,CAAA;AAE1B,KAFA,uBAAA,GAA0B,gBAEP,CAAA,SAAA,CAAA;AAAsB,KAAzC,mBAAyC,CAAA,qBAAA,WAAA,CAAA,GACnD,YADmD,SAAA,OAAA,GAE/C,qBAF+C,GAG/C,YAH+C,SAAA,SAAA,GAI7C,uBAJ6C,GAK7C,YAL6C,SAAA,MAAA,GAM3C,oBAN2C,GAO3C,YAP2C,SAAA,MAAA,GAQzC,uBARyC,GASzC,gBATyC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stryke/types",
3
- "version": "0.10.22",
3
+ "version": "0.10.24",
4
4
  "type": "module",
5
5
  "description": "A package containing many base TypeScript type definitions that are shared across many projects.",
6
6
  "repository": {
@@ -111,7 +111,7 @@
111
111
  "storm",
112
112
  "sullivanpj"
113
113
  ],
114
- "devDependencies": { "@types/node": "^24.10.1", "tsdown": "^0.17.1" },
114
+ "devDependencies": { "@types/node": "^24.10.4", "tsdown": "^0.17.2" },
115
115
  "publishConfig": { "access": "public" },
116
- "gitHead": "4fbdaeaa2b52b9665280e6c7cd5fee37031b9564"
116
+ "gitHead": "8f2e484743eb3ce54929e99096ca2ea188b4730e"
117
117
  }
@@ -1,122 +0,0 @@
1
- //#region src/array.d.ts
2
- /**
3
- * Matches any array or array-like object.
4
- */
5
- type Arrayable<T> = T | T[];
6
- type UnknownArray = readonly unknown[];
7
- /**
8
- * Matches any [typed array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray), like `Uint8Array` or `Float64Array`.
9
- */
10
- type TypedArray = BigInt64Array | BigUint64Array | Float32Array | Float64Array | Int8Array | Int16Array | Int32Array | Uint8Array | Uint8ClampedArray | Uint16Array | Uint32Array;
11
- /**
12
- * Infer the length of the given array `<T>`.
13
- *
14
- * Check out {@link https://itnext.io/implementing-arithmetic-within-typescripts-type-system-a1ef140a6f6f | this article} for more information.
15
- */
16
- type ArrayLength<T extends readonly unknown[]> = T extends {
17
- readonly length: infer L;
18
- } ? L : never;
19
- /**
20
- * Extract the element of an array that also works for array union.
21
- *
22
- * Returns `never` if T is not an array.
23
- *
24
- * It creates a type-safe way to access the element type of `unknown` type.
25
- */
26
- type ArrayElement<T> = T extends readonly unknown[] ? T[0] : never;
27
- /**
28
- * Provides all values for a constant array or tuple.
29
- *
30
- * Use-case: This type is useful when working with constant arrays or tuples and you want to enforce type-safety with their values.
31
- *
32
- * @example
33
- * ```
34
- * import type {ArrayValues, ArrayIndices} from 'type-fest';
35
- *
36
- * const weekdays = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'] as const;
37
- *
38
- * type WeekdayName = ArrayValues<typeof weekdays>;
39
- * type Weekday = ArrayIndices<typeof weekdays>;
40
- *
41
- * const getWeekdayName = (day: Weekday): WeekdayName => weekdays[day];
42
- * ```
43
- *
44
- * @see {@link ArrayIndices}
45
- */
46
- type ArrayValues<T extends readonly unknown[]> = T[number];
47
- /**
48
- * Provides valid indices for a constant array or tuple.
49
- *
50
- * Use-case: This type is useful when working with constant arrays or tuples and you want to enforce type-safety for accessing elements by their indices.
51
- *
52
- * @example
53
- * ```
54
- * import type {ArrayIndices, ArrayValues} from 'type-fest';
55
- *
56
- * const weekdays = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'] as const;
57
- *
58
- * type Weekday = ArrayIndices<typeof weekdays>;
59
- * type WeekdayName = ArrayValues<typeof weekdays>;
60
- *
61
- * const getWeekdayName = (day: Weekday): WeekdayName => weekdays[day];
62
- * ```
63
- *
64
- * @see {@link ArrayValues}
65
- */
66
- type ArrayIndices<Element extends readonly unknown[]> = Exclude<Partial<Element>["length"], Element["length"]>;
67
- /**
68
- * Matches any unknown array or tuple.
69
- */
70
- type UnknownArrayOrTuple = readonly [...unknown[]];
71
- /**
72
- * Extracts the type of the first element of an array or tuple.
73
- */
74
- type FirstArrayElement<TArray extends UnknownArrayOrTuple> = TArray extends readonly [infer THead, ...unknown[]] ? THead : never;
75
- /**
76
- * Extracts the type of the last element of an array.
77
- *
78
- * Use-case: Defining the return type of functions that extract the last element of an array, for example [`lodash.last`](https://lodash.com/docs/4.17.15#last).
79
- *
80
- * @example
81
- * ```
82
- * import type {LastArrayElement} from 'type-fest';
83
- *
84
- * declare function lastOf<V extends readonly any[]>(array: V): LastArrayElement<V>;
85
- *
86
- * const array = ['foo', 2];
87
- *
88
- * typeof lastOf(array);
89
- * //=> number
90
- *
91
- * const array = ['foo', 2] as const;
92
- *
93
- * typeof lastOf(array);
94
- * //=> 2
95
- * ```
96
- */
97
- type LastArrayElement<Elements extends readonly unknown[], ElementBeforeTailingSpreadElement = never> = Elements extends readonly [] ? ElementBeforeTailingSpreadElement : Elements extends readonly [...infer _U, infer V] ? V : Elements extends readonly [infer U, ...infer V] ? LastArrayElement<V, U> : Elements extends readonly (infer U)[] ? ElementBeforeTailingSpreadElement | U : never;
98
- /**
99
- * Returns the static, fixed-length portion of the given array, excluding variable-length parts.
100
- *
101
- * @example
102
- * ```
103
- * type A = [string, number, boolean, ...string[]];
104
- * type B = StaticPartOfArray<A>;
105
- * //=> [string, number, boolean]
106
- * ```
107
- */
108
- type StaticPartOfArray<T extends UnknownArray, Result extends UnknownArray = []> = T extends unknown ? number extends T["length"] ? T extends readonly [infer U, ...infer V] ? StaticPartOfArray<V, [...Result, U]> : Result : T : never;
109
- /**
110
- * Returns the variable, non-fixed-length portion of the given array, excluding static-length parts.
111
- *
112
- * @example
113
- * ```
114
- * type A = [string, number, boolean, ...string[]];
115
- * type B = VariablePartOfArray<A>;
116
- * //=> string[]
117
- * ```
118
- */
119
- type VariablePartOfArray<T extends UnknownArray> = T extends unknown ? T extends readonly [...StaticPartOfArray<T>, ...infer U] ? U : [] : never;
120
- //#endregion
121
- export { Arrayable as a, StaticPartOfArray as c, UnknownArrayOrTuple as d, VariablePartOfArray as f, ArrayValues as i, TypedArray as l, ArrayIndices as n, FirstArrayElement as o, ArrayLength as r, LastArrayElement as s, ArrayElement as t, UnknownArray as u };
122
- //# sourceMappingURL=array-DVtfX_TI.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"array-DVtfX_TI.d.mts","names":[],"sources":["../src/array.ts"],"sourcesContent":[],"mappings":";;AAqBA;AAEA;AAKY,KAPA,SAOU,CAAA,CAAA,CAAA,GAPK,CAOL,GAPS,CAOT,EAAA;AAClB,KANQ,YAAA,GAMR,SAAA,OAAA,EAAA;;;;AAIA,KALQ,UAAA,GACR,aAIA,GAHA,cAGA,GAFA,YAEA,GADA,YACA,GAAA,SAAA,GACA,UADA,GAEA,UAFA,GAGA,UAHA,GAIA,iBAJA,GAKA,WALA,GAMA,WANA;;;;;;AAMA,KAOQ,WAPR,CAAA,UAAA,SAAA,OAAA,EAAA,CAAA,GAOoD,CAPpD,SAAA;EAAW,SAAA,MAAA,EAAA,KAAA,EAAA;AAOf,CAAA,GAAY,CAAA,GAAA,KAAA;AAaZ;AAqBA;AAqBA;;;;;AAAsE,KA1C1D,YA0C0D,CAAA,CAAA,CAAA,GA1CxC,CA0CwC,SAAA,SAAA,OAAA,EAAA,GA1CT,CA0CS,CAAA,CAAA,CAAA,GAAA,KAAA;AAQtE;AAKA;AAyBA;;;;;;;;;;;;AA2BA;;;;;AAKM,KA3FM,WA2FN,CAAA,UAAA,SAAA,OAAA,EAAA,CAAA,GA3FkD,CA2FlD,CAAA,MAAA,CAAA;;;;;;;;AAgBN;;;;;;;;;;;;KAtFY,mDAAmD,QAC7D,QAAQ,oBACR;;;;KAMU,mBAAA;;;;KAKA,iCAAiC,uBAC3C;;;;;;;;;;;;;;;;;;;;;;;KAwBU,mGAKV,+BACI,oCACA,uDAEE,kDAGE,iBAAiB,GAAG,KACpB,wCACE,oCAAoC;;;;;;;;;;;KAapC,4BACA,6BACK,qBACb,mCACe,cACb,2CACE,kBAAkB,OAAO,QAAQ,MACjC,SACF;;;;;;;;;;;KAaM,8BAA8B,gBAAgB,oBACtD,uBAAuB,kBAAkB"}
@@ -1,122 +0,0 @@
1
- //#region src/array.d.ts
2
- /**
3
- * Matches any array or array-like object.
4
- */
5
- type Arrayable<T> = T | T[];
6
- type UnknownArray = readonly unknown[];
7
- /**
8
- * Matches any [typed array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray), like `Uint8Array` or `Float64Array`.
9
- */
10
- type TypedArray = BigInt64Array | BigUint64Array | Float32Array | Float64Array | Int8Array | Int16Array | Int32Array | Uint8Array | Uint8ClampedArray | Uint16Array | Uint32Array;
11
- /**
12
- * Infer the length of the given array `<T>`.
13
- *
14
- * Check out {@link https://itnext.io/implementing-arithmetic-within-typescripts-type-system-a1ef140a6f6f | this article} for more information.
15
- */
16
- type ArrayLength<T extends readonly unknown[]> = T extends {
17
- readonly length: infer L;
18
- } ? L : never;
19
- /**
20
- * Extract the element of an array that also works for array union.
21
- *
22
- * Returns `never` if T is not an array.
23
- *
24
- * It creates a type-safe way to access the element type of `unknown` type.
25
- */
26
- type ArrayElement<T> = T extends readonly unknown[] ? T[0] : never;
27
- /**
28
- * Provides all values for a constant array or tuple.
29
- *
30
- * Use-case: This type is useful when working with constant arrays or tuples and you want to enforce type-safety with their values.
31
- *
32
- * @example
33
- * ```
34
- * import type {ArrayValues, ArrayIndices} from 'type-fest';
35
- *
36
- * const weekdays = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'] as const;
37
- *
38
- * type WeekdayName = ArrayValues<typeof weekdays>;
39
- * type Weekday = ArrayIndices<typeof weekdays>;
40
- *
41
- * const getWeekdayName = (day: Weekday): WeekdayName => weekdays[day];
42
- * ```
43
- *
44
- * @see {@link ArrayIndices}
45
- */
46
- type ArrayValues<T extends readonly unknown[]> = T[number];
47
- /**
48
- * Provides valid indices for a constant array or tuple.
49
- *
50
- * Use-case: This type is useful when working with constant arrays or tuples and you want to enforce type-safety for accessing elements by their indices.
51
- *
52
- * @example
53
- * ```
54
- * import type {ArrayIndices, ArrayValues} from 'type-fest';
55
- *
56
- * const weekdays = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'] as const;
57
- *
58
- * type Weekday = ArrayIndices<typeof weekdays>;
59
- * type WeekdayName = ArrayValues<typeof weekdays>;
60
- *
61
- * const getWeekdayName = (day: Weekday): WeekdayName => weekdays[day];
62
- * ```
63
- *
64
- * @see {@link ArrayValues}
65
- */
66
- type ArrayIndices<Element extends readonly unknown[]> = Exclude<Partial<Element>["length"], Element["length"]>;
67
- /**
68
- * Matches any unknown array or tuple.
69
- */
70
- type UnknownArrayOrTuple = readonly [...unknown[]];
71
- /**
72
- * Extracts the type of the first element of an array or tuple.
73
- */
74
- type FirstArrayElement<TArray extends UnknownArrayOrTuple> = TArray extends readonly [infer THead, ...unknown[]] ? THead : never;
75
- /**
76
- * Extracts the type of the last element of an array.
77
- *
78
- * Use-case: Defining the return type of functions that extract the last element of an array, for example [`lodash.last`](https://lodash.com/docs/4.17.15#last).
79
- *
80
- * @example
81
- * ```
82
- * import type {LastArrayElement} from 'type-fest';
83
- *
84
- * declare function lastOf<V extends readonly any[]>(array: V): LastArrayElement<V>;
85
- *
86
- * const array = ['foo', 2];
87
- *
88
- * typeof lastOf(array);
89
- * //=> number
90
- *
91
- * const array = ['foo', 2] as const;
92
- *
93
- * typeof lastOf(array);
94
- * //=> 2
95
- * ```
96
- */
97
- type LastArrayElement<Elements extends readonly unknown[], ElementBeforeTailingSpreadElement = never> = Elements extends readonly [] ? ElementBeforeTailingSpreadElement : Elements extends readonly [...infer _U, infer V] ? V : Elements extends readonly [infer U, ...infer V] ? LastArrayElement<V, U> : Elements extends readonly (infer U)[] ? ElementBeforeTailingSpreadElement | U : never;
98
- /**
99
- * Returns the static, fixed-length portion of the given array, excluding variable-length parts.
100
- *
101
- * @example
102
- * ```
103
- * type A = [string, number, boolean, ...string[]];
104
- * type B = StaticPartOfArray<A>;
105
- * //=> [string, number, boolean]
106
- * ```
107
- */
108
- type StaticPartOfArray<T extends UnknownArray, Result extends UnknownArray = []> = T extends unknown ? number extends T["length"] ? T extends readonly [infer U, ...infer V] ? StaticPartOfArray<V, [...Result, U]> : Result : T : never;
109
- /**
110
- * Returns the variable, non-fixed-length portion of the given array, excluding static-length parts.
111
- *
112
- * @example
113
- * ```
114
- * type A = [string, number, boolean, ...string[]];
115
- * type B = VariablePartOfArray<A>;
116
- * //=> string[]
117
- * ```
118
- */
119
- type VariablePartOfArray<T extends UnknownArray> = T extends unknown ? T extends readonly [...StaticPartOfArray<T>, ...infer U] ? U : [] : never;
120
- //#endregion
121
- export { Arrayable as a, StaticPartOfArray as c, UnknownArrayOrTuple as d, VariablePartOfArray as f, ArrayValues as i, TypedArray as l, ArrayIndices as n, FirstArrayElement as o, ArrayLength as r, LastArrayElement as s, ArrayElement as t, UnknownArray as u };
122
- //# sourceMappingURL=array-DtIKbcDr.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"array-DtIKbcDr.d.cts","names":[],"sources":["../src/array.ts"],"sourcesContent":[],"mappings":";;AAqBA;AAEA;AAKY,KAPA,SAOU,CAAA,CAAA,CAAA,GAPK,CAOL,GAPS,CAOT,EAAA;AAClB,KANQ,YAAA,GAMR,SAAA,OAAA,EAAA;;;;AAIA,KALQ,UAAA,GACR,aAIA,GAHA,cAGA,GAFA,YAEA,GADA,YACA,GAAA,SAAA,GACA,UADA,GAEA,UAFA,GAGA,UAHA,GAIA,iBAJA,GAKA,WALA,GAMA,WANA;;;;;;AAMA,KAOQ,WAPR,CAAA,UAAA,SAAA,OAAA,EAAA,CAAA,GAOoD,CAPpD,SAAA;EAAW,SAAA,MAAA,EAAA,KAAA,EAAA;AAOf,CAAA,GAAY,CAAA,GAAA,KAAA;AAaZ;AAqBA;AAqBA;;;;;AAAsE,KA1C1D,YA0C0D,CAAA,CAAA,CAAA,GA1CxC,CA0CwC,SAAA,SAAA,OAAA,EAAA,GA1CT,CA0CS,CAAA,CAAA,CAAA,GAAA,KAAA;AAQtE;AAKA;AAyBA;;;;;;;;;;;;AA2BA;;;;;AAKM,KA3FM,WA2FN,CAAA,UAAA,SAAA,OAAA,EAAA,CAAA,GA3FkD,CA2FlD,CAAA,MAAA,CAAA;;;;;;;;AAgBN;;;;;;;;;;;;KAtFY,mDAAmD,QAC7D,QAAQ,oBACR;;;;KAMU,mBAAA;;;;KAKA,iCAAiC,uBAC3C;;;;;;;;;;;;;;;;;;;;;;;KAwBU,mGAKV,+BACI,oCACA,uDAEE,kDAGE,iBAAiB,GAAG,KACpB,wCACE,oCAAoC;;;;;;;;;;;KAapC,4BACA,6BACK,qBACb,mCACe,cACb,2CACE,kBAAkB,OAAO,QAAQ,MACjC,SACF;;;;;;;;;;;KAaM,8BAA8B,gBAAgB,oBACtD,uBAAuB,kBAAkB"}
@@ -1,111 +0,0 @@
1
- import { K as IsUnknown, j as FunctionLike } from "./base-CiIyKS-b.mjs";
2
-
3
- //#region src/async.d.ts
4
-
5
- /**
6
- * Get the type of the value that a promise resolves to.
7
- *
8
- * @example
9
- * ```
10
- * import type {Awaited} from 'type-fest';
11
- *
12
- * const value: Awaited<Promise<string>> = 'foo';
13
- * ```
14
- */
15
- type Awaitable<T> = T | PromiseLike<T>;
16
- /**
17
- * A type that can be either a value or a function that returns a value.
18
- *
19
- * @example
20
- * ```
21
- * import type {Resolvable} from 'type-fest';
22
- *
23
- * const foo: Resolvable<string> = 'bar';
24
- * const bar: Resolvable<string> = () => 'baz';
25
- * ```
26
- */
27
- type Resolvable<T> = Awaitable<T> | (() => Awaitable<T>);
28
- /**
29
- * Create a function type with a return type of your choice and the same parameters as the given function type.
30
- *
31
- * Use-case: You want to define a wrapped function that returns something different while receiving the same parameters. For example, you might want to wrap a function that can throw an error into one that will return `undefined` instead.
32
- *
33
- * @example
34
- * ```
35
- * import type {SetReturnType} from 'type-fest';
36
- *
37
- * type MyFunctionThatCanThrow = (foo: SomeType, bar: unknown) => SomeOtherType;
38
- *
39
- * type MyWrappedFunction = SetReturnType<MyFunctionThatCanThrow, SomeOtherType | undefined>;
40
- * //=> type MyWrappedFunction = (foo: SomeType, bar: unknown) => SomeOtherType | undefined;
41
- * ```
42
- */
43
- type SetReturnType<TFunct extends (...arguments_: any[]) => any, TypeToReturn> = TFunct extends ((this: infer ThisArgument, ...arguments_: infer Arguments) => any) ? IsUnknown<ThisArgument> extends true ? (...arguments_: Arguments) => TypeToReturn : (this: ThisArgument, ...arguments_: Arguments) => TypeToReturn : (...arguments_: Parameters<TFunct>) => TypeToReturn;
44
- type AsyncFunction = (...arguments_: any[]) => Promise<unknown>;
45
- /**
46
- * Unwrap the return type of a function that returns a `Promise`.
47
- *
48
- * There has been [discussion](https://github.com/microsoft/TypeScript/pull/35998) about implementing this type in TypeScript.
49
- *
50
- * @example
51
- * ```ts
52
- * import type {AsyncReturnType} from 'type-fest';
53
- * import {asyncFunction} from 'api';
54
- *
55
- * // This type resolves to the unwrapped return type of `asyncFunction`.
56
- * type Value = AsyncReturnType<typeof asyncFunction>;
57
- *
58
- * async function doSomething(value: Value) {}
59
- *
60
- * asyncFunction().then(value => doSomething(value));
61
- * ```
62
- */
63
- type AsyncReturnType<Target extends AsyncFunction> = Awaited<ReturnType<Target>>;
64
- /**
65
- * Create an async version of the given function type, by boxing the return type in `Promise` while keeping the same parameter types.
66
- *
67
- * Use-case: You have two functions, one synchronous and one asynchronous that do the same thing. Instead of having to duplicate the type definition, you can use `Asyncify` to reuse the synchronous type.
68
- *
69
- * @example
70
- * ```
71
- * import type {Asyncify} from 'type-fest';
72
- *
73
- * // Synchronous function.
74
- * function getFooSync(someArg: SomeType): Foo {
75
- * // …
76
- * }
77
- *
78
- * type AsyncifiedFooGetter = Asyncify<typeof getFooSync>;
79
- * //=> type AsyncifiedFooGetter = (someArg: SomeType) => Promise<Foo>;
80
- *
81
- * // Same as `getFooSync` but asynchronous.
82
- * const getFooAsync: AsyncifiedFooGetter = (someArg) => {
83
- * // TypeScript now knows that `someArg` is `SomeType` automatically.
84
- * // It also knows that this function must return `Promise<Foo>`.
85
- * // If you have `@typescript-eslint/promise-function-async` linter rule enabled, it will even report that "Functions that return promises must be async.".
86
- *
87
- * // …
88
- * }
89
- * ```
90
- */
91
- type Asyncify<TFunct extends FunctionLike> = SetReturnType<TFunct, Promise<Awaited<ReturnType<TFunct>>>>;
92
- /**
93
- * Get the result type of a `Promise`
94
- *
95
- * @example
96
- * ```ts
97
- * import { Await } from '@stryke/types'
98
- *
99
- * const promise = new Promise<string>((res, rej) => res('x'))
100
- *
101
- * type test0 = C.Await<typeof promise> // string
102
- * type test1 = C.Await<Promise<number>> // number
103
- * ```
104
- *
105
- * @param P - A promise
106
- * @returns [[Any]]
107
- */
108
- type Await<P> = P extends Promise<infer A> ? A : P;
109
- //#endregion
110
- export { Awaitable as a, Await as i, AsyncReturnType as n, Resolvable as o, Asyncify as r, SetReturnType as s, AsyncFunction as t };
111
- //# sourceMappingURL=async-BtPWg6IL.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"async-BtPWg6IL.d.mts","names":[],"sources":["../src/async.ts"],"sourcesContent":[],"mappings":";;;;;;AA8BA;;;;;AAaA;;;AAA4D,KAbhD,SAagD,CAAA,CAAA,CAAA,GAbjC,CAaiC,GAb7B,WAa6B,CAbjB,CAaiB,CAAA;;;AAiB5D;;;;;;;;;AAeiC,KAhCrB,UAgCqB,CAAA,CAAA,CAAA,GAhCL,SAgCK,CAhCK,CAgCL,CAAA,GAAA,CAAA,GAAA,GAhCiB,SAgCjB,CAhC2B,CAgC3B,CAAA,CAAA;;;;AAEjC;AAoBA;;;;;;AA+BA;;;;;AAEU,KAtEE,aAsEF,CAAA,eAAA,CAAA,GAAA,UAAA,EAAA,GAAA,EAAA,EAAA,GAAA,GAAA,EAAA,YAAA,CAAA,GAjER,MAiEQ,UAAA,CAAA,IAAA,EAAA,KAAA,aAAA,EAAA,GAAA,UAAA,EAAA,KAAA,UAAA,EAAA,GAAA,GAAA,IA3DJ,SA2DI,CA3DM,YA2DN,CAAA,SAAA,IAAA,GAAA,CAAA,GAAA,UAAA,EA1Dc,SA0Dd,EAAA,GA1D4B,YA0D5B,GAAA,CAAA,IAAA,EAzDK,YAyDL,EAAA,GAAA,UAAA,EAzDkC,SAyDlC,EAAA,GAzDgD,YAyDhD,GAAA,CAAA,GAAA,UAAA,EAvDY,UAuDZ,CAvDuB,MAuDvB,CAAA,EAAA,GAvDmC,YAuDnC;AAAR,KArDU,aAAA,GAqDV,CAAA,GAAA,UAAA,EAAA,GAAA,EAAA,EAAA,GArDoD,OAqDpD,CAAA,OAAA,CAAA;;;AAmBF;;;;;;;;;;;;;;;;KApDY,+BAA+B,iBAAiB,QAC1D,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA8BD,wBAAwB,gBAAgB,cAClD,QACA,QAAQ,QAAQ,WAAW;;;;;;;;;;;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