type-plus 7.0.1 → 7.1.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 (207) hide show
  1. package/README.md +4 -34
  2. package/cjs/any/any_type.d.ts +17 -7
  3. package/cjs/any/any_type.d.ts.map +1 -1
  4. package/cjs/array/array.some.d.ts +6 -2
  5. package/cjs/array/array.some.d.ts.map +1 -1
  6. package/cjs/array/array_plus.split_at.d.ts +1 -1
  7. package/cjs/array/array_plus.split_at.d.ts.map +1 -1
  8. package/cjs/array/reduce_while.js.map +1 -1
  9. package/cjs/assertion/assert_type.d.ts +3 -3
  10. package/cjs/assertion/assert_type.d.ts.map +1 -1
  11. package/cjs/assertion/assert_type.js +6 -3
  12. package/cjs/assertion/assert_type.js.map +1 -1
  13. package/cjs/bigint/bigint_type.d.ts +1 -1
  14. package/cjs/bigint/bigint_type.d.ts.map +1 -1
  15. package/cjs/bigint/strict_bigint_type.d.ts +1 -1
  16. package/cjs/bigint/strict_bigint_type.d.ts.map +1 -1
  17. package/cjs/binary/index.js +2 -25
  18. package/cjs/binary/index.js.map +1 -1
  19. package/cjs/boolean/boolean_type.d.ts +1 -1
  20. package/cjs/boolean/boolean_type.d.ts.map +1 -1
  21. package/cjs/boolean/false_type.d.ts +1 -1
  22. package/cjs/boolean/false_type.d.ts.map +1 -1
  23. package/cjs/boolean/strict_boolean_type.d.ts +1 -1
  24. package/cjs/boolean/strict_boolean_type.d.ts.map +1 -1
  25. package/cjs/boolean/true_type.d.ts +1 -1
  26. package/cjs/boolean/true_type.d.ts.map +1 -1
  27. package/cjs/equal/equal.d.ts +18 -18
  28. package/cjs/function/function_type.d.ts +1 -1
  29. package/cjs/function/function_type.d.ts.map +1 -1
  30. package/cjs/function/strict_function_type.d.ts +1 -1
  31. package/cjs/function/strict_function_type.d.ts.map +1 -1
  32. package/cjs/functional/context.js.map +1 -1
  33. package/cjs/index.d.ts +2 -2
  34. package/cjs/index.d.ts.map +1 -1
  35. package/cjs/index.js +7 -22
  36. package/cjs/index.js.map +1 -1
  37. package/cjs/mix_types/any_or_never_type.d.ts +29 -0
  38. package/cjs/mix_types/any_or_never_type.d.ts.map +1 -0
  39. package/cjs/{any/any_or_never.js → mix_types/any_or_never_type.js} +1 -1
  40. package/cjs/mix_types/any_or_never_type.js.map +1 -0
  41. package/cjs/number/number_type.d.ts +1 -1
  42. package/cjs/number/number_type.d.ts.map +1 -1
  43. package/cjs/numeric/integer.d.ts +1 -1
  44. package/cjs/numeric/integer.d.ts.map +1 -1
  45. package/cjs/numeric/numeric_type.d.ts +1 -1
  46. package/cjs/numeric/numeric_type.d.ts.map +1 -1
  47. package/cjs/object/ANotB.d.ts +3 -2
  48. package/cjs/object/ANotB.d.ts.map +1 -1
  49. package/cjs/object/Required.d.ts +1 -1
  50. package/cjs/object/Required.d.ts.map +1 -1
  51. package/cjs/object/findKey.d.ts +1 -1
  52. package/cjs/object/findKey.d.ts.map +1 -1
  53. package/cjs/object/forEachKey.d.ts +1 -1
  54. package/cjs/object/forEachKey.d.ts.map +1 -1
  55. package/cjs/object/hasProperty.d.ts +1 -1
  56. package/cjs/object/hasProperty.d.ts.map +1 -1
  57. package/cjs/object/object_type.d.ts +1 -1
  58. package/cjs/object/object_type.d.ts.map +1 -1
  59. package/cjs/object/split.d.ts +1 -1
  60. package/cjs/object/split.d.ts.map +1 -1
  61. package/cjs/package.json +3 -1
  62. package/cjs/primitive.d.ts +3 -0
  63. package/cjs/primitive.d.ts.map +1 -1
  64. package/cjs/string/string_type.d.ts +1 -1
  65. package/cjs/string/string_type.d.ts.map +1 -1
  66. package/cjs/symbol/symbol_type.d.ts +1 -1
  67. package/cjs/symbol/symbol_type.d.ts.map +1 -1
  68. package/cjs/testing/stub.d.ts +3 -0
  69. package/cjs/testing/stub.d.ts.map +1 -1
  70. package/cjs/testing/stub.js.map +1 -1
  71. package/cjs/type/failed.d.ts +1 -1
  72. package/cjs/type/failed.d.ts.map +1 -1
  73. package/cjs/type/no_infer.d.ts +9 -6
  74. package/cjs/type/no_infer.d.ts.map +1 -1
  75. package/cjs/type-guard/is_type.d.ts +1 -1
  76. package/cjs/type-guard/is_type.js +1 -1
  77. package/cjs/type-guard/is_type.js.map +1 -1
  78. package/cjs/unpartial.d.ts +2 -0
  79. package/cjs/unpartial.d.ts.map +1 -0
  80. package/cjs/unpartial.js +8 -0
  81. package/cjs/unpartial.js.map +1 -0
  82. package/cjs/void/void_type.d.ts +1 -1
  83. package/cjs/void/void_type.d.ts.map +1 -1
  84. package/esm/any/any_type.d.ts +17 -7
  85. package/esm/any/any_type.d.ts.map +1 -1
  86. package/esm/array/array.some.d.ts +6 -2
  87. package/esm/array/array.some.d.ts.map +1 -1
  88. package/esm/array/array_plus.split_at.d.ts +1 -1
  89. package/esm/array/array_plus.split_at.d.ts.map +1 -1
  90. package/esm/array/reduce_while.js.map +1 -1
  91. package/esm/assertion/assert_type.d.ts +3 -3
  92. package/esm/assertion/assert_type.d.ts.map +1 -1
  93. package/esm/assertion/assert_type.js +7 -3
  94. package/esm/assertion/assert_type.js.map +1 -1
  95. package/esm/bigint/bigint_type.d.ts +1 -1
  96. package/esm/bigint/bigint_type.d.ts.map +1 -1
  97. package/esm/bigint/strict_bigint_type.d.ts +1 -1
  98. package/esm/bigint/strict_bigint_type.d.ts.map +1 -1
  99. package/esm/boolean/boolean_type.d.ts +1 -1
  100. package/esm/boolean/boolean_type.d.ts.map +1 -1
  101. package/esm/boolean/false_type.d.ts +1 -1
  102. package/esm/boolean/false_type.d.ts.map +1 -1
  103. package/esm/boolean/strict_boolean_type.d.ts +1 -1
  104. package/esm/boolean/strict_boolean_type.d.ts.map +1 -1
  105. package/esm/boolean/true_type.d.ts +1 -1
  106. package/esm/boolean/true_type.d.ts.map +1 -1
  107. package/esm/equal/equal.d.ts +18 -18
  108. package/esm/function/function_type.d.ts +1 -1
  109. package/esm/function/function_type.d.ts.map +1 -1
  110. package/esm/function/strict_function_type.d.ts +1 -1
  111. package/esm/function/strict_function_type.d.ts.map +1 -1
  112. package/esm/functional/context.js.map +1 -1
  113. package/esm/index.d.ts +2 -2
  114. package/esm/index.d.ts.map +1 -1
  115. package/esm/index.js +1 -1
  116. package/esm/index.js.map +1 -1
  117. package/esm/mix_types/any_or_never_type.d.ts +29 -0
  118. package/esm/mix_types/any_or_never_type.d.ts.map +1 -0
  119. package/esm/mix_types/any_or_never_type.js +2 -0
  120. package/esm/mix_types/any_or_never_type.js.map +1 -0
  121. package/esm/number/number_type.d.ts +1 -1
  122. package/esm/number/number_type.d.ts.map +1 -1
  123. package/esm/numeric/integer.d.ts +1 -1
  124. package/esm/numeric/integer.d.ts.map +1 -1
  125. package/esm/numeric/numeric_type.d.ts +1 -1
  126. package/esm/numeric/numeric_type.d.ts.map +1 -1
  127. package/esm/object/ANotB.d.ts +3 -2
  128. package/esm/object/ANotB.d.ts.map +1 -1
  129. package/esm/object/Required.d.ts +1 -1
  130. package/esm/object/Required.d.ts.map +1 -1
  131. package/esm/object/findKey.d.ts +1 -1
  132. package/esm/object/findKey.d.ts.map +1 -1
  133. package/esm/object/forEachKey.d.ts +1 -1
  134. package/esm/object/forEachKey.d.ts.map +1 -1
  135. package/esm/object/hasProperty.d.ts +1 -1
  136. package/esm/object/hasProperty.d.ts.map +1 -1
  137. package/esm/object/object_type.d.ts +1 -1
  138. package/esm/object/object_type.d.ts.map +1 -1
  139. package/esm/object/split.d.ts +1 -1
  140. package/esm/object/split.d.ts.map +1 -1
  141. package/esm/primitive.d.ts +3 -0
  142. package/esm/primitive.d.ts.map +1 -1
  143. package/esm/string/string_type.d.ts +1 -1
  144. package/esm/string/string_type.d.ts.map +1 -1
  145. package/esm/symbol/symbol_type.d.ts +1 -1
  146. package/esm/symbol/symbol_type.d.ts.map +1 -1
  147. package/esm/testing/stub.d.ts +3 -0
  148. package/esm/testing/stub.d.ts.map +1 -1
  149. package/esm/testing/stub.js.map +1 -1
  150. package/esm/type/failed.d.ts +1 -1
  151. package/esm/type/failed.d.ts.map +1 -1
  152. package/esm/type/no_infer.d.ts +9 -6
  153. package/esm/type/no_infer.d.ts.map +1 -1
  154. package/esm/type-guard/is_type.d.ts +1 -1
  155. package/esm/type-guard/is_type.js +1 -1
  156. package/esm/type-guard/is_type.js.map +1 -1
  157. package/esm/unpartial.d.ts +2 -0
  158. package/esm/unpartial.d.ts.map +1 -0
  159. package/esm/unpartial.js +2 -0
  160. package/esm/unpartial.js.map +1 -0
  161. package/esm/void/void_type.d.ts +1 -1
  162. package/esm/void/void_type.d.ts.map +1 -1
  163. package/package.json +17 -28
  164. package/ts/any/any_type.ts +17 -7
  165. package/ts/array/array.some.ts +18 -4
  166. package/ts/array/array_plus.split_at.ts +1 -1
  167. package/ts/array/reduce_while.ts +1 -1
  168. package/ts/assertion/assert_type.ts +7 -4
  169. package/ts/bigint/bigint_type.ts +1 -1
  170. package/ts/bigint/strict_bigint_type.ts +1 -1
  171. package/ts/boolean/boolean_type.ts +1 -1
  172. package/ts/boolean/false_type.ts +1 -1
  173. package/ts/boolean/strict_boolean_type.ts +1 -1
  174. package/ts/boolean/true_type.ts +1 -1
  175. package/ts/equal/equal.ts +18 -18
  176. package/ts/function/function_type.ts +1 -1
  177. package/ts/function/strict_function_type.ts +1 -1
  178. package/ts/functional/context.ts +1 -1
  179. package/ts/index.ts +3 -2
  180. package/ts/mix_types/any_or_never_type.ts +30 -0
  181. package/ts/number/number_type.ts +1 -1
  182. package/ts/numeric/integer.ts +1 -1
  183. package/ts/numeric/numeric_type.ts +1 -1
  184. package/ts/object/ANotB.ts +2 -1
  185. package/ts/object/Required.ts +1 -1
  186. package/ts/object/findKey.ts +1 -1
  187. package/ts/object/forEachKey.ts +1 -1
  188. package/ts/object/hasProperty.ts +1 -1
  189. package/ts/object/object_type.ts +1 -1
  190. package/ts/object/split.ts +1 -1
  191. package/ts/primitive.ts +3 -0
  192. package/ts/string/string_type.ts +1 -1
  193. package/ts/symbol/symbol_type.ts +1 -1
  194. package/ts/testing/stub.ts +3 -0
  195. package/ts/type/failed.ts +1 -1
  196. package/ts/type/no_infer.ts +9 -6
  197. package/ts/type-guard/is_type.ts +2 -2
  198. package/ts/unpartial.ts +1 -0
  199. package/ts/void/void_type.ts +1 -1
  200. package/cjs/any/any_or_never.d.ts +0 -15
  201. package/cjs/any/any_or_never.d.ts.map +0 -1
  202. package/cjs/any/any_or_never.js.map +0 -1
  203. package/esm/any/any_or_never.d.ts +0 -15
  204. package/esm/any/any_or_never.d.ts.map +0 -1
  205. package/esm/any/any_or_never.js +0 -2
  206. package/esm/any/any_or_never.js.map +0 -1
  207. package/ts/any/any_or_never.ts +0 -15
@@ -1 +1 @@
1
- {"version":3,"file":"stub.js","sourceRoot":"","sources":["../../ts/testing/stub.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAWxC,MAAM,UAAU,IAAI,CAAI,IAAa;IACpC,OAAO,IAAS,CAAA;AACjB,CAAC;AAQD,SAAS,KAAK,CAAI,IAAiF;IAClG,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,CAAA;AAC9B,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,SAAS,OAAO,CAAI,IAAiF;IACpG,OAAO,eAAe,CAAC,CAAC,IAAI,CAAC,CAAC,CAAA;AAC/B,CAAC;AAED,SAAS,eAAe,CACvB,YAAgG;IAEhG,MAAM,OAAO,GAAG;QACf;;;;;;;WAOG;QACH,IAAI,CAAC,IAAiF;YACrF,OAAO,eAAe,CAAC,CAAC,GAAG,YAAY,EAAE,IAAI,CAAC,CAAC,CAAA;QAChD,CAAC;QACD;;WAEG;QAEH,MAAM;YACL,OAAO,CAAC,IAA0B,EAAE,EAAE;gBACrC,OAAO,YAAY,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE;oBACxC,IAAI,OAAO,IAAI,KAAK,UAAU,EAAE;wBAC/B,OAAO,IAAI,CAAC,GAAG,CAAC,CAAA;qBAChB;oBACD,OAAO,YAAY,CAAsB,IAAI,EAAE,GAAG,CAAC,CAAA;gBACpD,CAAC,EAAE,IAAI,CAAM,CAAA;YACd,CAAC,CAAA;QACF,CAAC;KACD,CAAA;IACD,OAAO,OAAO,CAAA;AACf,CAAC;AACD,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;AAClB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA"}
1
+ {"version":3,"file":"stub.js","sourceRoot":"","sources":["../../ts/testing/stub.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAcxC,MAAM,UAAU,IAAI,CAAI,IAAa;IACpC,OAAO,IAAS,CAAA;AACjB,CAAC;AAQD,SAAS,KAAK,CAAI,IAAiF;IAClG,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,CAAA;AAC9B,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,SAAS,OAAO,CAAI,IAAiF;IACpG,OAAO,eAAe,CAAC,CAAC,IAAI,CAAC,CAAC,CAAA;AAC/B,CAAC;AAED,SAAS,eAAe,CACvB,YAAgG;IAEhG,MAAM,OAAO,GAAG;QACf;;;;;;;WAOG;QACH,IAAI,CAAC,IAAiF;YACrF,OAAO,eAAe,CAAC,CAAC,GAAG,YAAY,EAAE,IAAI,CAAC,CAAC,CAAA;QAChD,CAAC;QACD;;WAEG;QAEH,MAAM;YACL,OAAO,CAAC,IAA0B,EAAE,EAAE;gBACrC,OAAO,YAAY,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE;oBACxC,IAAI,OAAO,IAAI,KAAK,UAAU,EAAE;wBAC/B,OAAO,IAAI,CAAC,GAAG,CAAC,CAAA;qBAChB;oBACD,OAAO,YAAY,CAAsB,IAAI,EAAE,GAAG,CAAC,CAAA;gBACpD,CAAC,EAAE,IAAI,CAAM,CAAA;YACd,CAAC,CAAA;QACF,CAAC;KACD,CAAA;IACD,OAAO,OAAO,CAAA;AACf,CAAC;AACD,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;AAClB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA"}
@@ -25,7 +25,7 @@ export interface Failed<Msg extends string> {
25
25
  *
26
26
  * It's recommended to create custom failed types instead of using this to provide better message.
27
27
  */
28
- export interface FailedT<Msg extends string, T> {
28
+ export interface FailedT<Msg extends string, _T> {
29
29
  [uniSym]: Msg;
30
30
  }
31
31
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"failed.d.ts","sourceRoot":"","sources":["../../ts/type/failed.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,MAAM,EAAE,OAAO,MAAM,CAAA;AAEnC;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,MAAM,CAAC,GAAG,SAAS,MAAM;IACzC,CAAC,MAAM,CAAC,EAAE,GAAG,CAAA;CACb;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,OAAO,CAAC,GAAG,SAAS,MAAM,EAAE,CAAC;IAC7C,CAAC,MAAM,CAAC,EAAE,GAAG,CAAA;CACb"}
1
+ {"version":3,"file":"failed.d.ts","sourceRoot":"","sources":["../../ts/type/failed.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,MAAM,EAAE,OAAO,MAAM,CAAA;AAEnC;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,MAAM,CAAC,GAAG,SAAS,MAAM;IACzC,CAAC,MAAM,CAAC,EAAE,GAAG,CAAA;CACb;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,OAAO,CAAC,GAAG,SAAS,MAAM,EAAE,EAAE;IAC9C,CAAC,MAAM,CAAC,EAAE,GAAG,CAAA;CACb"}
@@ -1,13 +1,13 @@
1
- import { IsNull } from '../null/null_type.js';
2
- import { Or } from '../predicates/logical.js';
3
- import { IsUndefined } from '../undefined/undefined_type.js';
1
+ import type { IsNull } from '../null/null_type.js';
2
+ import type { Or } from '../predicates/logical.js';
3
+ import type { IsUndefined } from '../undefined/undefined_type.js';
4
4
  /**
5
5
  * Prevents inference of a type parameter `T`.
6
6
  *
7
- * A build-in type `NoInfer` is coming soon.
8
- * @see https://github.com/microsoft/TypeScript/pull/52968
7
+ * 🦴 *utilities*
9
8
  *
10
- * @by @ajafff
9
+ * @ajafff original version author
10
+ * @see https://github.com/microsoft/TypeScript/issues/14829#issuecomment-298425341
11
11
  *
12
12
  * @example
13
13
  * ```ts
@@ -19,6 +19,9 @@ import { IsUndefined } from '../undefined/undefined_type.js';
19
19
  * assertEqual(123, 'abc') // Error
20
20
  * assertEqual({ x: 1 }, { x: 1, y: 2 }) // Error
21
21
  * ```
22
+ *
23
+ * A build-in `NoInfer` is coming soon.
24
+ * @see https://github.com/microsoft/TypeScript/pull/52968
22
25
  */
23
26
  export type NoInfer<T> = Or<IsNull<T>, IsUndefined<T>, T, T & {}>;
24
27
  //# sourceMappingURL=no_infer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"no_infer.d.ts","sourceRoot":"","sources":["../../ts/type/no_infer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAC7C,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAA;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAA;AAE5D;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,MAAM,OAAO,CAAC,CAAC,IAAI,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,CAAA"}
1
+ {"version":3,"file":"no_infer.d.ts","sourceRoot":"","sources":["../../ts/type/no_infer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAClD,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAA;AAClD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAA;AAEjE;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,MAAM,OAAO,CAAC,CAAC,IAAI,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,CAAA"}
@@ -11,7 +11,7 @@ export declare namespace isType {
11
11
  var t: <T extends true>(subject?: T | undefined) => boolean;
12
12
  var f: <T extends false>(subject?: T | undefined) => boolean;
13
13
  var never: typeof isNever;
14
- var equal: <C extends IsEqual<A, B>, A, B>() => void;
14
+ var equal: <_C extends IsEqual<A, B>, A, B>() => void;
15
15
  }
16
16
  /**
17
17
  * Check is the type `never`
@@ -13,7 +13,7 @@ isType.t = function (subject) {
13
13
  isType.f = function (subject) {
14
14
  return subject === undefined || subject === false;
15
15
  };
16
- function isNever(subject) {
16
+ function isNever(_subject) {
17
17
  return true;
18
18
  }
19
19
  isType.never = isNever;
@@ -1 +1 @@
1
- {"version":3,"file":"is_type.js","sourceRoot":"","sources":["../../ts/type-guard/is_type.ts"],"names":[],"mappings":"AAUA,MAAM,UAAU,MAAM,CAAC,OAAgB,EAAE,SAAmC;IAC3E,OAAO,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA;AAC/C,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,CAAC,GAAG,UAA0B,OAAW;IAC/C,OAAO,OAAO,KAAK,SAAS,IAAI,OAAO,KAAK,IAAI,CAAA;AACjD,CAAC,CAAA;AAED;;GAEG;AACH,MAAM,CAAC,CAAC,GAAG,UAA2B,OAAW;IAChD,OAAO,OAAO,KAAK,SAAS,IAAI,OAAO,KAAK,KAAK,CAAA;AAClD,CAAC,CAAA;AAYD,SAAS,OAAO,CAAC,OAAiB;IACjC,OAAO,IAAI,CAAA;AACZ,CAAC;AAED,MAAM,CAAC,KAAK,GAAG,OAAO,CAAA;AAEtB;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,GAAG,cAA4C,CAAC,CAAA"}
1
+ {"version":3,"file":"is_type.js","sourceRoot":"","sources":["../../ts/type-guard/is_type.ts"],"names":[],"mappings":"AAUA,MAAM,UAAU,MAAM,CAAC,OAAgB,EAAE,SAAmC;IAC3E,OAAO,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA;AAC/C,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,CAAC,GAAG,UAA0B,OAAW;IAC/C,OAAO,OAAO,KAAK,SAAS,IAAI,OAAO,KAAK,IAAI,CAAA;AACjD,CAAC,CAAA;AAED;;GAEG;AACH,MAAM,CAAC,CAAC,GAAG,UAA2B,OAAW;IAChD,OAAO,OAAO,KAAK,SAAS,IAAI,OAAO,KAAK,KAAK,CAAA;AAClD,CAAC,CAAA;AAYD,SAAS,OAAO,CAAC,QAAkB;IAClC,OAAO,IAAI,CAAA;AACZ,CAAC;AAED,MAAM,CAAC,KAAK,GAAG,OAAO,CAAA;AAEtB;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,GAAG,cAA6C,CAAC,CAAA"}
@@ -0,0 +1,2 @@
1
+ export { required, requiredDeep, unpartial } from 'unpartial';
2
+ //# sourceMappingURL=unpartial.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unpartial.d.ts","sourceRoot":"","sources":["../ts/unpartial.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA"}
@@ -0,0 +1,2 @@
1
+ export { required, requiredDeep, unpartial } from 'unpartial';
2
+ //# sourceMappingURL=unpartial.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unpartial.js","sourceRoot":"","sources":["../ts/unpartial.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA"}
@@ -1,4 +1,4 @@
1
- import type { IsAnyOrNever } from '../any/any_or_never.js';
1
+ import type { IsAnyOrNever } from '../mix_types/any_or_never_type.js';
2
2
  import type { IsUndefined } from '../undefined/undefined_type.js';
3
3
  /**
4
4
  * Check if `T` is `void`.
@@ -1 +1 @@
1
- {"version":3,"file":"void_type.d.ts","sourceRoot":"","sources":["../../ts/void/void_type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAA;AAC1D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAA;AAEjE;;;;;;;;GAQG;AACH,MAAM,MAAM,QAAQ,CAAC,CAAC,EAAE,IAAI,GAAG,CAAC,EAAE,IAAI,GAAG,KAAK,IAAI,YAAY,CAC7D,CAAC,EACD,IAAI,EACJ,WAAW,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC,CACtD,CAAA;AAED;;;;;;;;GAQG;AACH,MAAM,MAAM,WAAW,CAAC,CAAC,EAAE,IAAI,GAAG,CAAC,EAAE,IAAI,GAAG,KAAK,IAAI,QAAQ,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA;AAE5E;;;;;;;;GAQG;AACH,MAAM,MAAM,MAAM,CAAC,CAAC,EAAE,IAAI,GAAG,IAAI,EAAE,IAAI,GAAG,KAAK,IAAI,QAAQ,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA;AAE1E;;;;;;;;GAQG;AACH,MAAM,MAAM,SAAS,CAAC,CAAC,EAAE,IAAI,GAAG,IAAI,EAAE,IAAI,GAAG,KAAK,IAAI,QAAQ,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA"}
1
+ {"version":3,"file":"void_type.d.ts","sourceRoot":"","sources":["../../ts/void/void_type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAA;AACrE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAA;AAEjE;;;;;;;;GAQG;AACH,MAAM,MAAM,QAAQ,CAAC,CAAC,EAAE,IAAI,GAAG,CAAC,EAAE,IAAI,GAAG,KAAK,IAAI,YAAY,CAC7D,CAAC,EACD,IAAI,EACJ,WAAW,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC,CACtD,CAAA;AAED;;;;;;;;GAQG;AACH,MAAM,MAAM,WAAW,CAAC,CAAC,EAAE,IAAI,GAAG,CAAC,EAAE,IAAI,GAAG,KAAK,IAAI,QAAQ,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA;AAE5E;;;;;;;;GAQG;AACH,MAAM,MAAM,MAAM,CAAC,CAAC,EAAE,IAAI,GAAG,IAAI,EAAE,IAAI,GAAG,KAAK,IAAI,QAAQ,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA;AAE1E;;;;;;;;GAQG;AACH,MAAM,MAAM,SAAS,CAAC,CAAC,EAAE,IAAI,GAAG,IAAI,EAAE,IAAI,GAAG,KAAK,IAAI,QAAQ,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA"}
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "type-plus",
3
- "version": "7.0.1",
3
+ "version": "7.1.0",
4
4
  "description": "Provides additional types for TypeScript.",
5
- "homepage": "https://github.com/unional/type-plus",
5
+ "homepage": "https://github.com/unional/type-plus/tree/main/type-plus",
6
6
  "bugs": {
7
7
  "url": "https://github.com/unional/type-plus/issues"
8
8
  },
@@ -18,8 +18,14 @@
18
18
  "sideEffects": false,
19
19
  "type": "module",
20
20
  "exports": {
21
- "import": "./esm/index.js",
22
- "require": "./cjs/index.js"
21
+ "import": {
22
+ "types": "./esm/index.d.ts",
23
+ "default": "./esm/index.js"
24
+ },
25
+ "require": {
26
+ "types": "./cjs/index.d.ts",
27
+ "default": "./cjs/index.js"
28
+ }
23
29
  },
24
30
  "main": "./cjs/index.js",
25
31
  "module": "./esm/index.js",
@@ -30,67 +36,50 @@
30
36
  "ts",
31
37
  "!ts/types",
32
38
  "!ts/type-checker",
33
- "!**/*.{spec,test,unit,accept,integrate,system}.*"
39
+ "!**/*.{spec,test,unit,accept,integrate,system,perf,stress}.*"
34
40
  ],
35
41
  "dependencies": {
36
42
  "tersify": "^3.11.1",
37
43
  "unpartial": "^1.0.4"
38
44
  },
39
45
  "devDependencies": {
40
- "@changesets/cli": "^2.25.2",
41
- "@commitlint/cli": "^17.0.2",
42
- "@commitlint/config-conventional": "^17.0.2",
43
46
  "@jest/globals": "^29.5.0",
44
47
  "@repobuddy/jest": "^3.4.0",
48
+ "@repobuddy/typescript": "^1.2.0",
45
49
  "@size-limit/esbuild-why": "^8.2.4",
46
50
  "@size-limit/preset-small-lib": "^8.2.4",
47
51
  "@types/node": "^18.0.0",
48
- "@typescript-eslint/eslint-plugin": "^5.28.0",
49
- "@typescript-eslint/parser": "^5.48.0",
50
52
  "@unional/fixture": "^3.0.0",
51
53
  "assertron": "^11.0.1",
52
54
  "cross-env": "^7.0.3",
53
55
  "depcheck": "^1.4.3",
54
- "eslint": "^8.17.0",
55
- "eslint-config-prettier": "^8.7.0",
56
- "eslint-plugin-harmony": "^7.1.2",
57
- "husky": "^8.0.1",
58
56
  "jest": "^29.5.0",
59
57
  "jest-watch-suspend": "^1.1.2",
60
58
  "jest-watch-toggle-config-2": "^2.1.0",
61
59
  "jest-watch-typeahead": "^2.2.2",
62
- "ncp": "^2.0.0",
63
60
  "npm-run-all": "^4.1.5",
64
- "pinst": "^3.0.0",
61
+ "repobuddy": "^1.0.2",
65
62
  "rimraf": "^5.0.0",
66
63
  "satisfier": "^5.2.2",
67
64
  "size-limit": "^8.2.4",
68
65
  "ts-jest": "^29.1.0",
69
66
  "tslib": "^2.4.0",
70
- "typedoc": "^0.24.1",
71
- "typedoc-plugin-extras": "^2.3.2",
72
- "typescript": "^5.0.2"
67
+ "typescript": "^5.0.4"
73
68
  },
74
- "packageManager": "pnpm@8.5.0",
75
69
  "scripts": {
76
70
  "build": "run-p build:cjs build:esm build:tslib",
77
- "build:cjs": "tsc -p tsconfig.cjs.json && ncp package.cjs.json cjs/package.json",
71
+ "build:cjs": "buddy ts build cjs",
78
72
  "build:esm": "tsc -p tsconfig.esm.json",
79
- "build:tslib": "tsc -p tsconfig.tslib.json && ncp package.cjs.json tslib/package.json",
80
- "build:doc": "typedoc --plugin typedoc-plugin-extras",
81
- "clean": "rimraf cjs coverage esm lib libm tslib",
73
+ "build:tslib": "buddy ts build tslib",
74
+ "clean": "rimraf cjs coverage esm lib libm tslib --glob *.tsbuildinfo",
82
75
  "coverage": "cross-env NODE_OPTIONS=--experimental-vm-modules NODE_NO_WARNINGS=1 jest --coverage",
83
- "cs": "changeset",
84
76
  "depcheck": "depcheck",
85
77
  "lint": "eslint --ext=ts,js .",
86
78
  "nuke": "pnpm clean && rimraf node_modules",
87
- "_postinstall": "husky install",
88
- "release": "changeset publish",
89
79
  "size": "size-limit",
90
80
  "test": "cross-env NODE_OPTIONS=--experimental-vm-modules NODE_NO_WARNINGS=1 jest",
91
81
  "test:watch": "cross-env NODE_OPTIONS=--experimental-vm-modules NODE_NO_WARNINGS=1 jest --watch",
92
82
  "verify": "npm-run-all clean -p build depcheck lint coverage -p size",
93
- "version": "changeset version",
94
83
  "watch": "cross-env NODE_OPTIONS=--experimental-vm-modules NODE_NO_WARNINGS=1 jest --watch",
95
84
  "w": "cross-env NODE_OPTIONS=--experimental-vm-modules NODE_NO_WARNINGS=1 jest --watch"
96
85
  }
@@ -1,7 +1,10 @@
1
1
 
2
2
  /**
3
- * Check if the type `T` is exactly `any`.
3
+ * Parse `T` to ensure it is exactly `any`.
4
4
  *
5
+ * 🐾 *parse*
6
+ *
7
+ * @example
5
8
  * ```ts
6
9
  * type R = AnyType<any> // any
7
10
  *
@@ -13,8 +16,11 @@
13
16
  export type AnyType<T, Then = T, Else = never> = 0 extends 1 & T ? Then : Else
14
17
 
15
18
  /**
16
- * Is the type `T` exactly `any`.
19
+ * Validate if `T` is exactly `any`.
20
+ *
21
+ * 🎭 *validate*
17
22
  *
23
+ * @example
18
24
  * ```ts
19
25
  * type R = IsAny<any> // true
20
26
  *
@@ -26,11 +32,12 @@ export type AnyType<T, Then = T, Else = never> = 0 extends 1 & T ? Then : Else
26
32
  export type IsAny<T, Then = true, Else = false> = AnyType<T, Then, Else>
27
33
 
28
34
  /**
29
- * Check if the type `T` is not `any`.
35
+ * Parse `T` to ensure it is not exactly `any`.
30
36
  *
31
- * ```
32
- * import type { NotAnyType } from 'type-plus'
37
+ * 🐾 *parse*
33
38
  *
39
+ * @example
40
+ * ```ts
34
41
  * type R = NotAnyType<any> // never
35
42
  *
36
43
  * type R = NotAnyType<never> // never
@@ -41,9 +48,12 @@ export type IsAny<T, Then = true, Else = false> = AnyType<T, Then, Else>
41
48
  export type NotAnyType<T, Then = T, Else = never> = AnyType<T, Else, Then>
42
49
 
43
50
  /**
44
- * Is the type `T` not `any`.
51
+ * Validate if `T` is not exactly `any`.
45
52
  *
46
- * ```
53
+ * 🎭 *validate*
54
+ *
55
+ * @example
56
+ * ```ts
47
57
  * import type { IsNotAny } from 'type-plus'
48
58
  *
49
59
  * type R = IsNotAny<any> // false
@@ -11,6 +11,8 @@ import type { UnionOfValues } from './union_of_values.js'
11
11
  *
12
12
  * You can also change it to `strict` mode.
13
13
  *
14
+ * 🔧 *utilities*
15
+ *
14
16
  * @example
15
17
  * ```ts
16
18
  * Some<string[], string> // true
@@ -30,11 +32,16 @@ export type Some<
30
32
 
31
33
  export namespace Some {
32
34
  export type Strict<A extends unknown[], Criteria, Then, Else> = number extends A['length']
33
- ? IsEqual<UnionOfValues<A>, Criteria> extends true
34
- ? Then
35
- : Else
35
+ ? StrictArray<A, Criteria, Then, Else>
36
36
  : StrictTuple<A, Criteria, Then, Else>
37
37
 
38
+ export type StrictArray<A extends unknown[], Criteria, Then, Else> = IsEqual<
39
+ UnionOfValues<A>,
40
+ Criteria,
41
+ Then,
42
+ Else
43
+ >
44
+
38
45
  export type StrictTuple<A extends unknown[], Criteria, Then, Else> = A['length'] extends 0
39
46
  ? Else
40
47
  : IsEqual<A[0], Criteria> extends true
@@ -42,9 +49,16 @@ export namespace Some {
42
49
  : StrictTuple<Tail<A>, Criteria, Then, Else>
43
50
 
44
51
  export type Loose<A extends unknown[], Criteria, Then, Else> = number extends A['length']
45
- ? CanAssign<UnionOfValues<A>, Criteria, Then, Else>
52
+ ? LooseArray<A, Criteria, Then, Else>
46
53
  : LooseTuple<A, Criteria, Then, Else>
47
54
 
55
+ export type LooseArray<A extends unknown[], Criteria, Then, Else> = CanAssign<
56
+ UnionOfValues<A>,
57
+ Criteria,
58
+ Then,
59
+ Else
60
+ >
61
+
48
62
  export type LooseTuple<A extends unknown[], Criteria, Then, Else> = A['length'] extends 0
49
63
  ? Else
50
64
  : A[0] extends Criteria
@@ -1,5 +1,5 @@
1
1
  import type { IndexAt } from './array_index.js'
2
- import { ArrayType } from './array_type.js'
2
+ import type { ArrayType } from './array_type.js'
3
3
 
4
4
  /**
5
5
  * Splits an array into two at the specified `Index`.
@@ -6,7 +6,7 @@ export function reduceWhile<T, R>(
6
6
  ) {
7
7
  let acc = initialValue
8
8
  for (let i = 0; i < array.length; i++) {
9
- const value = array[i]
9
+ const value = array[i]!
10
10
  if (!predicate(acc, value)) return acc
11
11
  acc = callbackfn(acc, value, i, array)
12
12
  }
@@ -1,6 +1,6 @@
1
1
  import { tersify } from 'tersify'
2
2
  import { isConstructor, type AnyConstructor } from '../class/index.js'
3
- import { AnyFunction } from '../function/any_function.js'
3
+ import { type AnyFunction } from '../function/any_function.js'
4
4
 
5
5
  /**
6
6
  * assert the subject satisfies the specified type T
@@ -82,7 +82,10 @@ assertType.noFunction = function <S>(subject: Exclude<S, AnyFunction>): void {
82
82
  }
83
83
 
84
84
  /**
85
- * @deprecated
85
+ * 💀 deprecated. It does not work in all cases.
86
+ *
87
+ * It passes for function that can be called with `new`.
88
+ * If the subject is an arrow function, it can still return true after compilation.
86
89
  */
87
90
  assertType.isConstructor = function (subject: AnyConstructor): asserts subject is AnyConstructor {
88
91
  if (!isConstructor(subject)) throw TypeError(`subject is not a constructor`)
@@ -95,7 +98,7 @@ assertType.noError = function <S>(subject: Exclude<S, Error>): void {
95
98
  if (subject instanceof Error) throw TypeError(`subject is an Error`)
96
99
  }
97
100
 
98
- assertType.isNever = function (subject: never): asserts subject is never {}
101
+ assertType.isNever = function (_subject: never): asserts _subject is never {}
99
102
 
100
103
  /**
101
104
  * creates a custom assertion function with standard TypeError.
@@ -110,4 +113,4 @@ assertType.custom = function <T>(validator: (s: T) => boolean): (subject: unknow
110
113
  }
111
114
  }
112
115
 
113
- assertType.as = function <T>(subject: unknown): asserts subject is T {}
116
+ assertType.as = function <T>(_subject: unknown): asserts _subject is T {}
@@ -1,4 +1,4 @@
1
- import type { IsAnyOrNever } from '../any/any_or_never.js'
1
+ import type { IsAnyOrNever } from '../mix_types/any_or_never_type.js'
2
2
 
3
3
  /**
4
4
  * Check if the type `T` is exactly `bigint`.
@@ -1,4 +1,4 @@
1
- import type { IsAnyOrNever } from '../any/any_or_never.js'
1
+ import type { IsAnyOrNever } from '../mix_types/any_or_never_type.js'
2
2
 
3
3
  /**
4
4
  * Check if the type `T` is exactly `bigint`.
@@ -1,4 +1,4 @@
1
- import type { IsAnyOrNever } from '../any/any_or_never.js'
1
+ import type { IsAnyOrNever } from '../mix_types/any_or_never_type.js'
2
2
 
3
3
  /**
4
4
  * Check if the type `T` is `boolean`, including `true` and `false`.
@@ -1,4 +1,4 @@
1
- import type { IsAnyOrNever } from '../any/any_or_never.js'
1
+ import type { IsAnyOrNever } from '../mix_types/any_or_never_type.js'
2
2
 
3
3
  /**
4
4
  * Check if the type `T` is exactly `false`.
@@ -1,4 +1,4 @@
1
- import type { IsAnyOrNever } from '../any/any_or_never.js'
1
+ import type { IsAnyOrNever } from '../mix_types/any_or_never_type.js'
2
2
 
3
3
  /**
4
4
  * Check if the type `T` is exactly `boolean`.
@@ -1,4 +1,4 @@
1
- import type { IsAnyOrNever } from '../any/any_or_never.js'
1
+ import type { IsAnyOrNever } from '../mix_types/any_or_never_type.js'
2
2
 
3
3
  /**
4
4
  * Check if the type `T` is exactly `true`.
package/ts/equal/equal.ts CHANGED
@@ -26,16 +26,16 @@ type IdentityEqual<A, B, Then, Else> = (<_>() => _ extends (A & _) | _ ? 1 : 2)
26
26
  * Checks `A` and `B` are equal.
27
27
  *
28
28
  * ```ts
29
- * type R = Equal<1, 1> // true
30
- * type R = Equal<any, any> // true
31
- * type R = Equal<boolean, boolean> // true
32
- * type R = Equal<true, true> // true
33
- * type R = Equal<[1], [1]> // true
29
+ * type R = IsEqual<1, 1> // true
30
+ * type R = IsEqual<any, any> // true
31
+ * type R = IsEqual<boolean, boolean> // true
32
+ * type R = IsEqual<true, true> // true
33
+ * type R = IsEqual<[1], [1]> // true
34
34
  *
35
- * type R = Equal<boolean, true> // false
36
- * type R = Equal<any, 1> // false
37
- * type R = Equal<[any], [1]> // false
38
- * type R = Equal<{ a: 1 }, { a: 1; b: 2 }> // false
35
+ * type R = IsEqual<boolean, true> // false
36
+ * type R = IsEqual<any, 1> // false
37
+ * type R = IsEqual<[any], [1]> // false
38
+ * type R = IsEqual<{ a: 1 }, { a: 1; b: 2 }> // false
39
39
  * ```
40
40
  *
41
41
  * Note that intersection type checks only works at first level.
@@ -81,16 +81,16 @@ export type IsEqual<A, B, Then = true, Else = false> = [A, B] extends [B, A]
81
81
  * Checks `A` and `B` are not equal.
82
82
  *
83
83
  * ```ts
84
- * type R = NotEqual<1, 1> // false
85
- * type R = NotEqual<any, any> // false
86
- * type R = NotEqual<boolean, boolean> // false
87
- * type R = NotEqual<true, true> // false
88
- * type R = NotEqual<[1], [1]> // false
84
+ * type R = IsNotEqual<1, 1> // false
85
+ * type R = IsNotEqual<any, any> // false
86
+ * type R = IsNotEqual<boolean, boolean> // false
87
+ * type R = IsNotEqual<true, true> // false
88
+ * type R = IsNotEqual<[1], [1]> // false
89
89
  *
90
- * type R = NotEqual<boolean, true> // true
91
- * type R = NotEqual<any, 1> // true
92
- * type R = NotEqual<[any], [1]> // true
93
- * type R = NotEqual<{ a: 1 }, { a: 1; b: 2 }> // true
90
+ * type R = IsNotEqual<boolean, true> // true
91
+ * type R = IsNotEqual<any, 1> // true
92
+ * type R = IsNotEqual<[any], [1]> // true
93
+ * type R = IsNotEqual<{ a: 1 }, { a: 1; b: 2 }> // true
94
94
  * ```
95
95
  *
96
96
  * Note that intersection type checks only works at first level.
@@ -1,4 +1,4 @@
1
- import type { IsAnyOrNever } from '../any/any_or_never.js'
1
+ import type { IsAnyOrNever } from '../mix_types/any_or_never_type.js'
2
2
 
3
3
  /**
4
4
  * Check if `T` is a `Function`.
@@ -1,4 +1,4 @@
1
- import type { IsAnyOrNever } from '../any/any_or_never.js'
1
+ import type { IsAnyOrNever } from '../mix_types/any_or_never_type.js'
2
2
 
3
3
  /**
4
4
  * Check if `T` is exactly `Function`.
@@ -57,7 +57,7 @@ function contextBuilder(init: ContextBaseShape, extenders: Array<[ContextExtende
57
57
  },
58
58
  build() {
59
59
  return extenders.reduce((p, [t], i) => {
60
- const v = typeof t === 'function' ? (extenders[i][0] = t(p)) : t
60
+ const v = typeof t === 'function' ? (extenders[i]![0] = t(p)) : t
61
61
  return { ...p, ...v }
62
62
  }, init)
63
63
  }
package/ts/index.ts CHANGED
@@ -1,5 +1,3 @@
1
- export { required, requiredDeep, unpartial } from 'unpartial'
2
- export type { IsAnyOrNever } from './any/any_or_never.js'
3
1
  export type { AnyType, IsAny, IsNotAny, NotAnyType } from './any/any_type.js'
4
2
  export type { At } from './array/array.at.js'
5
3
  export type { Concat } from './array/array.concat.js'
@@ -40,6 +38,7 @@ export * from './functional/index.js'
40
38
  export type { JSONArray, JSONObject, JSONPrimitive, JSONTypes } from './json.js'
41
39
  export type { Abs, Add, Decrement, GreaterThan, Increment, Max, Multiply, Subtract } from './math/index.js'
42
40
  export * as MathPlus from './math/math_plus.js'
41
+ export type { AnyOrNeverType, IsAnyOrNever } from './mix_types/any_or_never_type.js'
43
42
  export type { IsNever, IsNotNever, Is_Never, NeverType, NotNeverType, Not_Never } from './never/never_type.js'
44
43
  export * from './nodejs/index.js'
45
44
  export * from './nominal/index.js'
@@ -97,5 +96,7 @@ export type {
97
96
  } from './undefined/undefined_type.js'
98
97
  export type { UnionKeys } from './union_keys.js'
99
98
  export type { IsNotUnknown, IsUnknown, NotUnknownType, UnknownType } from './unknown/unknown_type.js'
99
+ export * from './unpartial.js'
100
100
  export * from './utils/index.js'
101
101
  export type { IsNotVoid, IsVoid, NotVoidType, VoidType } from './void/void_type.js'
102
+
@@ -0,0 +1,30 @@
1
+ import type { IsNever } from '../never/never_type.js'
2
+ import type { IsAny } from '../any/any_type.js'
3
+
4
+ /**
5
+ * 🐾 Parse `T` to ensure it is either exactly `any` or exactly `never`.
6
+ *
7
+ * @example
8
+ * ```ts
9
+ * type R = AnyType<any> // any
10
+ *
11
+ * type R = AnyType<never> // never
12
+ * type R = AnyType<unknown> // never
13
+ * type R = AnyType<string | boolean> // never
14
+ * ```
15
+ */
16
+ export type AnyOrNeverType<T, Then = T, Else = never> = IsNever<T, Then, IsAny<T, Then, Else>>
17
+
18
+ /**
19
+ * 🎭 Validate if `T` is either exactly `any` or exactly `never`.
20
+ *
21
+ * @example
22
+ * ```ts
23
+ * type R = IsAnyOrNever<any> // true
24
+ * type R = IsAnyOrNever<never> // true
25
+ *
26
+ * type R = IsAnyOrNever<1> // false
27
+ * type R = IsAnyOrNever<unknown> // false
28
+ * ```
29
+ */
30
+ export type IsAnyOrNever<T, Then = true, Else = false> = IsNever<T, Then, IsAny<T, Then, Else>>
@@ -1,4 +1,4 @@
1
- import type { IsAnyOrNever } from '../any/any_or_never.js'
1
+ import type { IsAnyOrNever } from '../mix_types/any_or_never_type.js'
2
2
 
3
3
  /**
4
4
  * Check if the type `T` is `number`.
@@ -1,4 +1,4 @@
1
- import type { IsAnyOrNever } from '../any/any_or_never.js'
1
+ import type { IsAnyOrNever } from '../mix_types/any_or_never_type.js'
2
2
  import type { Numeric } from './numeric_type.js'
3
3
 
4
4
  /**
@@ -1,4 +1,4 @@
1
- import type { IsAnyOrNever } from '../any/any_or_never.js'
1
+ import type { IsAnyOrNever } from '../mix_types/any_or_never_type.js'
2
2
 
3
3
  /**
4
4
  * Either number or bigint.
@@ -2,6 +2,7 @@ import type { IsEqual } from '../equal/equal.js'
2
2
  import type { AnyRecord } from './AnyRecord.js'
3
3
  import type { IsDisjoint } from './IsDisjoint.js'
4
4
  import type { KeysWithDiffType } from './KeysWithDiffType.js'
5
+ import type { Properties } from './properties.js'
5
6
 
6
7
  export type ANotB<A extends AnyRecord, B extends AnyRecord> = IsEqual<A, B> extends true
7
8
  ? never
@@ -15,4 +16,4 @@ export type LeftJoin<A extends AnyRecord, B extends AnyRecord> = IsEqual<A, B> e
15
16
  ? A
16
17
  : IsDisjoint<A, B> extends true
17
18
  ? A & B
18
- : { [k in Exclude<keyof A, keyof B>]: A[k] } & { [k in keyof B]: B[k] }
19
+ : Properties<{ [k in Exclude<keyof A, keyof B>]: A[k] } & { [k in keyof B]: B[k] }>
@@ -1,6 +1,6 @@
1
1
  // Thanks [jack-williams](https://github.com/jack-williams) for the [solution](https://github.com/Microsoft/TypeScript/issues/29269#issuecomment-451602962)
2
2
 
3
- import { NonUndefined } from '../utils/NonUndefined.js'
3
+ import type { NonUndefined } from '../utils/NonUndefined.js'
4
4
 
5
5
  export type Required<T> = { [P in keyof T]-?: NonUndefined<T[P]> }
6
6
 
@@ -1,4 +1,4 @@
1
- import { KeyTypes } from './KeyTypes.js'
1
+ import type { KeyTypes } from './KeyTypes.js'
2
2
 
3
3
  export function findKey<S extends Record<KeyTypes, any>, T = any>(
4
4
  subject: S,
@@ -1,4 +1,4 @@
1
- import { KeyTypes } from './KeyTypes.js'
1
+ import type { KeyTypes } from './KeyTypes.js'
2
2
 
3
3
  export function forEachKey<S extends Record<KeyTypes, any>, T = any>(
4
4
  subject: S,
@@ -1,4 +1,4 @@
1
- import { UnionKeys } from '../union_keys.js'
1
+ import type { UnionKeys } from '../union_keys.js'
2
2
 
3
3
  export function hasProperty<T, P extends UnionKeys<T>>(value: T, prop: P): value is T & Record<P, T[P]> {
4
4
  return !!value[prop]
@@ -1,4 +1,4 @@
1
- import type { IsAnyOrNever } from '../any/any_or_never.js'
1
+ import type { IsAnyOrNever } from '../mix_types/any_or_never_type.js'
2
2
 
3
3
  /**
4
4
  * Check if `T` is an `object`.
@@ -3,7 +3,7 @@ import type { AnyRecord } from './AnyRecord.js'
3
3
  import type { Omit } from './omit.js'
4
4
  import { reduceByKey } from './reduceKey.js'
5
5
  import type { Partial } from './Partial.js'
6
- import { NonUndefined } from '../utils/NonUndefined.js'
6
+ import type { NonUndefined } from '../utils/NonUndefined.js'
7
7
 
8
8
  type Splitter<T extends AnyRecord> = Partial<{ [k in keyof T]: T[k] | undefined }>
9
9
  export type Split<T extends AnyRecord, S extends AnyRecord> = {