type-plus 8.0.0-beta.4 → 8.0.0-beta.6

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 (216) hide show
  1. package/cjs/array/is_array.d.ts +4 -4
  2. package/cjs/array/is_array.d.ts.map +1 -1
  3. package/cjs/array/is_not_array.d.ts +4 -4
  4. package/cjs/array/is_not_array.d.ts.map +1 -1
  5. package/cjs/array/literal_array.js +2 -1
  6. package/cjs/array/literal_array.js.map +1 -1
  7. package/cjs/array/reduce_while.js +2 -1
  8. package/cjs/array/reduce_while.js.map +1 -1
  9. package/cjs/assertion/assert_type.d.ts +1 -1
  10. package/cjs/assertion/assert_type.d.ts.map +1 -1
  11. package/cjs/assertion/assert_type.js +2 -1
  12. package/cjs/assertion/assert_type.js.map +1 -1
  13. package/cjs/bigint/is_bigint.d.ts +4 -4
  14. package/cjs/bigint/is_bigint.d.ts.map +1 -1
  15. package/cjs/bigint/is_not_bigint.d.ts +3 -3
  16. package/cjs/bigint/is_not_bigint.d.ts.map +1 -1
  17. package/cjs/boolean/is_boolean.d.ts +4 -4
  18. package/cjs/boolean/is_boolean.d.ts.map +1 -1
  19. package/cjs/boolean/is_not_boolean.d.ts +3 -3
  20. package/cjs/boolean/is_not_boolean.d.ts.map +1 -1
  21. package/cjs/class/isConstructor.js +3 -2
  22. package/cjs/class/isConstructor.js.map +1 -1
  23. package/cjs/function/extract_function.d.ts.map +1 -1
  24. package/cjs/function/extract_function.js +2 -1
  25. package/cjs/function/extract_function.js.map +1 -1
  26. package/cjs/functional/Maybe.js +3 -2
  27. package/cjs/functional/Maybe.js.map +1 -1
  28. package/cjs/functional/compose.js +2 -1
  29. package/cjs/functional/compose.js.map +1 -1
  30. package/cjs/functional/context.js +2 -1
  31. package/cjs/functional/context.js.map +1 -1
  32. package/cjs/index.d.ts +2 -1
  33. package/cjs/index.d.ts.map +1 -1
  34. package/cjs/index.js.map +1 -1
  35. package/cjs/mix_types/merge.js +2 -1
  36. package/cjs/mix_types/merge.js.map +1 -1
  37. package/cjs/nodejs/isNodeError.js +2 -1
  38. package/cjs/nodejs/isNodeError.js.map +1 -1
  39. package/cjs/nominal/brand.js +2 -1
  40. package/cjs/nominal/brand.js.map +1 -1
  41. package/cjs/nominal/flavor.js +2 -1
  42. package/cjs/nominal/flavor.js.map +1 -1
  43. package/cjs/nominal/nominal_match.js +2 -1
  44. package/cjs/nominal/nominal_match.js.map +1 -1
  45. package/cjs/number/is_not_number.d.ts +3 -3
  46. package/cjs/number/is_not_number.d.ts.map +1 -1
  47. package/cjs/number/is_number.d.ts +3 -3
  48. package/cjs/number/is_number.d.ts.map +1 -1
  49. package/cjs/object/adjust_exact_optional_props.d.ts +16 -0
  50. package/cjs/object/adjust_exact_optional_props.d.ts.map +1 -0
  51. package/cjs/object/adjust_exact_optional_props.js +3 -0
  52. package/cjs/object/adjust_exact_optional_props.js.map +1 -0
  53. package/cjs/object/everyKey.js +2 -1
  54. package/cjs/object/everyKey.js.map +1 -1
  55. package/cjs/object/facade.js +2 -1
  56. package/cjs/object/facade.js.map +1 -1
  57. package/cjs/object/filterKey.js +2 -1
  58. package/cjs/object/filterKey.js.map +1 -1
  59. package/cjs/object/findKey.js +2 -1
  60. package/cjs/object/findKey.js.map +1 -1
  61. package/cjs/object/forEachKey.js +2 -1
  62. package/cjs/object/forEachKey.js.map +1 -1
  63. package/cjs/object/getField.js +2 -1
  64. package/cjs/object/getField.js.map +1 -1
  65. package/cjs/object/hasKey.js +2 -1
  66. package/cjs/object/hasKey.js.map +1 -1
  67. package/cjs/object/hasProperty.js +2 -1
  68. package/cjs/object/hasProperty.js.map +1 -1
  69. package/cjs/object/index.d.ts +1 -0
  70. package/cjs/object/index.d.ts.map +1 -1
  71. package/cjs/object/index.js.map +1 -1
  72. package/cjs/object/is_not_object.d.ts +4 -4
  73. package/cjs/object/is_not_object.d.ts.map +1 -1
  74. package/cjs/object/is_object.d.ts +4 -4
  75. package/cjs/object/is_object.d.ts.map +1 -1
  76. package/cjs/object/mapKey.js +2 -1
  77. package/cjs/object/mapKey.js.map +1 -1
  78. package/cjs/object/mapProperties.js +2 -1
  79. package/cjs/object/mapProperties.js.map +1 -1
  80. package/cjs/object/omit.js +2 -1
  81. package/cjs/object/omit.js.map +1 -1
  82. package/cjs/object/pick.js +2 -1
  83. package/cjs/object/pick.js.map +1 -1
  84. package/cjs/object/record.js +2 -1
  85. package/cjs/object/record.js.map +1 -1
  86. package/cjs/object/reduceKey.js +2 -2
  87. package/cjs/object/reduceKey.js.map +1 -1
  88. package/cjs/object/replaceProperty.js +2 -1
  89. package/cjs/object/replaceProperty.js.map +1 -1
  90. package/cjs/object/someKey.js +2 -1
  91. package/cjs/object/someKey.js.map +1 -1
  92. package/cjs/object/split.js +2 -1
  93. package/cjs/object/split.js.map +1 -1
  94. package/cjs/object/typeOverrideIncompatible.d.ts.map +1 -1
  95. package/cjs/object/typeOverrideIncompatible.js +2 -1
  96. package/cjs/object/typeOverrideIncompatible.js.map +1 -1
  97. package/cjs/predicates/CanAssign.js +2 -1
  98. package/cjs/predicates/CanAssign.js.map +1 -1
  99. package/cjs/promise/MaybePromise.js +2 -2
  100. package/cjs/promise/MaybePromise.js.map +1 -1
  101. package/cjs/promise/isPromise.js +2 -1
  102. package/cjs/promise/isPromise.js.map +1 -1
  103. package/cjs/promise/mapSeries.js +2 -1
  104. package/cjs/promise/mapSeries.js.map +1 -1
  105. package/cjs/string/is_not_string.d.ts +3 -3
  106. package/cjs/string/is_not_string.d.ts.map +1 -1
  107. package/cjs/string/is_not_string_literal.d.ts +4 -4
  108. package/cjs/string/is_not_string_literal.d.ts.map +1 -1
  109. package/cjs/string/is_string.d.ts +3 -3
  110. package/cjs/string/is_string.d.ts.map +1 -1
  111. package/cjs/string/is_string_literal.d.ts +4 -4
  112. package/cjs/string/is_string_literal.d.ts.map +1 -1
  113. package/cjs/testing/stub.d.ts +2 -2
  114. package/cjs/testing/stub.d.ts.map +1 -1
  115. package/cjs/testing/stub.js +2 -1
  116. package/cjs/testing/stub.js.map +1 -1
  117. package/cjs/tuple/drop.js +2 -1
  118. package/cjs/tuple/drop.js.map +1 -1
  119. package/cjs/type-guard/is_type.d.ts +2 -2
  120. package/cjs/type-guard/is_type.d.ts.map +1 -1
  121. package/cjs/type-guard/is_type.js +2 -1
  122. package/cjs/type-guard/is_type.js.map +1 -1
  123. package/cjs/type_plus/branch/$exact.d.ts +13 -22
  124. package/cjs/type_plus/branch/$exact.d.ts.map +1 -1
  125. package/cjs/type_plus/branch/$select.d.ts +3 -3
  126. package/cjs/type_plus/branch/$select.d.ts.map +1 -1
  127. package/cjs/union/sub_union.d.ts +6 -0
  128. package/cjs/union/sub_union.d.ts.map +1 -0
  129. package/cjs/union/sub_union.js +3 -0
  130. package/cjs/union/sub_union.js.map +1 -0
  131. package/cjs/union/union_to_intersection.js +2 -1
  132. package/cjs/union/union_to_intersection.js.map +1 -1
  133. package/cjs/utils/as.d.ts +1 -1
  134. package/cjs/utils/as.d.ts.map +1 -1
  135. package/cjs/utils/as.js +4 -3
  136. package/cjs/utils/as.js.map +1 -1
  137. package/cjs/utils/inspect.js +2 -1
  138. package/cjs/utils/inspect.js.map +1 -1
  139. package/esm/array/is_array.d.ts +4 -4
  140. package/esm/array/is_array.d.ts.map +1 -1
  141. package/esm/array/is_not_array.d.ts +4 -4
  142. package/esm/array/is_not_array.d.ts.map +1 -1
  143. package/esm/assertion/assert_type.d.ts +1 -1
  144. package/esm/assertion/assert_type.d.ts.map +1 -1
  145. package/esm/bigint/is_bigint.d.ts +4 -4
  146. package/esm/bigint/is_bigint.d.ts.map +1 -1
  147. package/esm/bigint/is_not_bigint.d.ts +3 -3
  148. package/esm/bigint/is_not_bigint.d.ts.map +1 -1
  149. package/esm/boolean/is_boolean.d.ts +4 -4
  150. package/esm/boolean/is_boolean.d.ts.map +1 -1
  151. package/esm/boolean/is_not_boolean.d.ts +3 -3
  152. package/esm/boolean/is_not_boolean.d.ts.map +1 -1
  153. package/esm/function/extract_function.d.ts.map +1 -1
  154. package/esm/index.d.ts +2 -1
  155. package/esm/index.d.ts.map +1 -1
  156. package/esm/index.js.map +1 -1
  157. package/esm/number/is_not_number.d.ts +3 -3
  158. package/esm/number/is_not_number.d.ts.map +1 -1
  159. package/esm/number/is_number.d.ts +3 -3
  160. package/esm/number/is_number.d.ts.map +1 -1
  161. package/esm/object/adjust_exact_optional_props.d.ts +16 -0
  162. package/esm/object/adjust_exact_optional_props.d.ts.map +1 -0
  163. package/esm/object/adjust_exact_optional_props.js +2 -0
  164. package/esm/object/adjust_exact_optional_props.js.map +1 -0
  165. package/esm/object/index.d.ts +1 -0
  166. package/esm/object/index.d.ts.map +1 -1
  167. package/esm/object/index.js.map +1 -1
  168. package/esm/object/is_not_object.d.ts +4 -4
  169. package/esm/object/is_not_object.d.ts.map +1 -1
  170. package/esm/object/is_object.d.ts +4 -4
  171. package/esm/object/is_object.d.ts.map +1 -1
  172. package/esm/object/typeOverrideIncompatible.d.ts.map +1 -1
  173. package/esm/string/is_not_string.d.ts +3 -3
  174. package/esm/string/is_not_string.d.ts.map +1 -1
  175. package/esm/string/is_not_string_literal.d.ts +4 -4
  176. package/esm/string/is_not_string_literal.d.ts.map +1 -1
  177. package/esm/string/is_string.d.ts +3 -3
  178. package/esm/string/is_string.d.ts.map +1 -1
  179. package/esm/string/is_string_literal.d.ts +4 -4
  180. package/esm/string/is_string_literal.d.ts.map +1 -1
  181. package/esm/testing/stub.d.ts +2 -2
  182. package/esm/testing/stub.d.ts.map +1 -1
  183. package/esm/type-guard/is_type.d.ts +2 -2
  184. package/esm/type-guard/is_type.d.ts.map +1 -1
  185. package/esm/type_plus/branch/$exact.d.ts +13 -22
  186. package/esm/type_plus/branch/$exact.d.ts.map +1 -1
  187. package/esm/type_plus/branch/$select.d.ts +3 -3
  188. package/esm/type_plus/branch/$select.d.ts.map +1 -1
  189. package/esm/union/sub_union.d.ts +6 -0
  190. package/esm/union/sub_union.d.ts.map +1 -0
  191. package/esm/union/sub_union.js +2 -0
  192. package/esm/union/sub_union.js.map +1 -0
  193. package/esm/utils/as.d.ts +1 -1
  194. package/esm/utils/as.d.ts.map +1 -1
  195. package/package.json +16 -21
  196. package/readme.md +25 -24
  197. package/src/array/is_array.ts +4 -4
  198. package/src/array/is_not_array.ts +4 -4
  199. package/src/bigint/is_bigint.ts +4 -4
  200. package/src/bigint/is_not_bigint.ts +3 -3
  201. package/src/boolean/is_boolean.ts +4 -4
  202. package/src/boolean/is_not_boolean.ts +3 -3
  203. package/src/index.ts +2 -1
  204. package/src/number/is_not_number.ts +3 -3
  205. package/src/number/is_number.ts +3 -3
  206. package/src/object/adjust_exact_optional_props.ts +14 -0
  207. package/src/object/index.ts +1 -0
  208. package/src/object/is_not_object.ts +4 -4
  209. package/src/object/is_object.ts +4 -4
  210. package/src/string/is_not_string.ts +3 -3
  211. package/src/string/is_not_string_literal.ts +4 -4
  212. package/src/string/is_string.ts +3 -3
  213. package/src/string/is_string_literal.ts +4 -4
  214. package/src/type_plus/branch/$exact.ts +18 -28
  215. package/src/type_plus/branch/$select.ts +3 -3
  216. package/src/union/sub_union.ts +5 -0
@@ -3,7 +3,7 @@ import type { $Equality } from '../type_plus/$equality.js'
3
3
  import type { $MergeOptions } from '../type_plus/$merge_options.js'
4
4
  import type { $ResolveOptions } from '../type_plus/$resolve_options.js'
5
5
  import type { $SpecialType } from '../type_plus/$special_type.js'
6
- import type { $Exact } from '../type_plus/branch/$exact.js'
6
+ import type { $ExactOptions } from '../type_plus/branch/$exact.js'
7
7
  import type { $IsDistributive } from '../type_plus/branch/$is_distributive.js'
8
8
  import type { $ResolveBranch } from '../type_plus/branch/$resolve_branch.js'
9
9
  import type { $Else, $Then } from '../type_plus/branch/$selection.js'
@@ -79,7 +79,7 @@ export type IsNotBigint<T, $O extends IsNotBigint.$Options = {}> = $SpecialType<
79
79
  >
80
80
 
81
81
  export namespace IsNotBigint {
82
- export type $Options = $Equality.$Options & $Exact.$Options
82
+ export type $Options = $Equality.$Options & $ExactOptions
83
83
  export type $Branch<$O extends $Options = {}> = $Equality.$Branch<$O>
84
84
 
85
85
  /**
@@ -93,7 +93,7 @@ export namespace IsNotBigint {
93
93
  export type $<T, $O extends $UtilOptions> = $ResolveOptions<[$O['exact'], false]> extends true
94
94
  ? $IsDistributive<$O, { $then: _SD<T, $O>; $else: _SN<T, $O> }>
95
95
  : NotAssignable.$<T, bigint, $O>
96
- export type $UtilOptions = NotAssignable.$UtilOptions & $Exact.$Options
96
+ export type $UtilOptions = NotAssignable.$UtilOptions & $ExactOptions
97
97
 
98
98
  export type _SD<T, $O extends $Options> = T extends bigint & infer U
99
99
  ? U extends bigint
@@ -3,7 +3,7 @@ import type { $Equality } from '../type_plus/$equality.js'
3
3
  import type { $MergeOptions } from '../type_plus/$merge_options.js'
4
4
  import type { $ResolveOptions } from '../type_plus/$resolve_options.js'
5
5
  import type { $SpecialType } from '../type_plus/$special_type.js'
6
- import type { $Exact } from '../type_plus/branch/$exact.js'
6
+ import type { $ExactDefault, $ExactOptions } from '../type_plus/branch/$exact.js'
7
7
  import type { $IsDistributive } from '../type_plus/branch/$is_distributive.js'
8
8
  import type { $ResolveBranch } from '../type_plus/branch/$resolve_branch.js'
9
9
  import type { $Else, $Then } from '../type_plus/branch/$selection.js'
@@ -70,7 +70,7 @@ export type IsBoolean<T, $O extends IsBoolean.$Options = {}> = $SpecialType<
70
70
  >
71
71
  >
72
72
  export namespace IsBoolean {
73
- export type $Options = $Equality.$Options & $Exact.$Options
73
+ export type $Options = $Equality.$Options & $ExactOptions
74
74
  export type $Branch<$O extends $Options = {}> = $Equality.$Branch<$O>
75
75
 
76
76
  /**
@@ -81,10 +81,10 @@ export namespace IsBoolean {
81
81
  * This is a type util for building custom types.
82
82
  * It does not check against special types.
83
83
  */
84
- export type $<T, $O extends $UtilOptions> = $ResolveOptions<[$O['exact'], $Exact.$Default]> extends true
84
+ export type $<T, $O extends $UtilOptions> = $ResolveOptions<[$O['exact'], $ExactDefault]> extends true
85
85
  ? $IsDistributive<$O, { $then: _SD<T, $O>; $else: _N<T, $O> }>
86
86
  : Assignable.$<T, boolean, $O>
87
- export type $UtilOptions = Assignable.$UtilOptions & $Exact.$Options
87
+ export type $UtilOptions = Assignable.$UtilOptions & $ExactOptions
88
88
 
89
89
  export type _SD<T, $O extends $Options> = IsBoolean._DistributeMap<T> extends infer R
90
90
  ? ['aBcD' | 'AbCd' | 'abcd'] extends [R]
@@ -3,7 +3,7 @@ import type { $Equality } from '../type_plus/$equality.js'
3
3
  import type { $MergeOptions } from '../type_plus/$merge_options.js'
4
4
  import type { $ResolveOptions } from '../type_plus/$resolve_options.js'
5
5
  import type { $SpecialType } from '../type_plus/$special_type.js'
6
- import type { $Exact } from '../type_plus/branch/$exact.js'
6
+ import type { $ExactOptions } from '../type_plus/branch/$exact.js'
7
7
  import type { $IsDistributive } from '../type_plus/branch/$is_distributive.js'
8
8
  import type { $ResolveBranch } from '../type_plus/branch/$resolve_branch.js'
9
9
  import type { $Else, $Then } from '../type_plus/branch/$selection.js'
@@ -72,7 +72,7 @@ export type IsNotBoolean<T, $O extends IsNotBoolean.$Options = {}> = $SpecialTyp
72
72
  >
73
73
 
74
74
  export namespace IsNotBoolean {
75
- export type $Options = $Equality.$Options & $Exact.$Options
75
+ export type $Options = $Equality.$Options & $ExactOptions
76
76
  export type $Branch<$O extends $Options = {}> = $Equality.$Branch<$O>
77
77
 
78
78
  /**
@@ -86,7 +86,7 @@ export namespace IsNotBoolean {
86
86
  export type $<T, $O extends $UtilOptions> = $ResolveOptions<[$O['exact'], false]> extends true
87
87
  ? $IsDistributive<$O, { $then: _D<T, $O>; $else: _N<T, $O> }>
88
88
  : NotAssignable.$<T, boolean, $O>
89
- export type $UtilOptions = NotAssignable.$UtilOptions & $Exact.$Options
89
+ export type $UtilOptions = NotAssignable.$UtilOptions & $ExactOptions
90
90
 
91
91
  export type _D<T, $O extends $Options> = IsBoolean._DistributeMap<T> extends infer R
92
92
  ? ['aBcD' | 'AbCd' | 'abcd'] extends [R]
package/src/index.ts CHANGED
@@ -73,11 +73,11 @@ export type * from './numeric/is_numeric.js'
73
73
  export type * from './numeric/is_positive.js'
74
74
  export * as NumericPlus from './numeric/numeric_plus.js'
75
75
  export type * from './numeric/numeric_type.js'
76
- export type { Required, RequiredExcept, RequiredPick } from './object/Required.js'
77
76
  export * from './object/index.js'
78
77
  export type * from './object/is_not_object.js'
79
78
  export type * from './object/is_object.js'
80
79
  export * as ObjectPlus from './object/object_plus.js'
80
+ export type { Required, RequiredExcept, RequiredPick } from './object/Required.js'
81
81
  export type * from './predicates/assignable.js'
82
82
  export * from './predicates/index.js'
83
83
  export type * from './predicates/not_assignable.js'
@@ -125,6 +125,7 @@ export type * from './type_plus/branch/$selection_options.js'
125
125
  export type * from './undefined/has_undefined.js'
126
126
  export type * from './undefined/is_not_undefined.js'
127
127
  export type * from './undefined/is_undefined.js'
128
+ export type * from './union/sub_union.js'
128
129
  export type { IsUnion, UnionType } from './union/union.js'
129
130
  export type { UnionKeys } from './union_keys.js'
130
131
  export type * from './unknown/is_not_unknown.js'
@@ -3,7 +3,7 @@ import type { $Equality } from '../type_plus/$equality.js'
3
3
  import type { $MergeOptions } from '../type_plus/$merge_options.js'
4
4
  import type { $ResolveOptions } from '../type_plus/$resolve_options.js'
5
5
  import type { $SpecialType } from '../type_plus/$special_type.js'
6
- import type { $Exact } from '../type_plus/branch/$exact.js'
6
+ import type { $ExactOptions } from '../type_plus/branch/$exact.js'
7
7
  import type { $IsDistributive } from '../type_plus/branch/$is_distributive.js'
8
8
  import type { $ResolveBranch } from '../type_plus/branch/$resolve_branch.js'
9
9
  import type { $Else, $Then } from '../type_plus/branch/$selection.js'
@@ -69,7 +69,7 @@ export type IsNotNumber<T, $O extends IsNotNumber.$Options = {}> = $SpecialType<
69
69
  >
70
70
 
71
71
  export namespace IsNotNumber {
72
- export type $Options = $Equality.$Options & $Exact.$Options
72
+ export type $Options = $Equality.$Options & $ExactOptions
73
73
  export type $Branch<$O extends $Options = {}> = $Equality.$Branch<$O>
74
74
 
75
75
  /**
@@ -83,7 +83,7 @@ export namespace IsNotNumber {
83
83
  export type $<T, $O extends $UtilOptions> = $ResolveOptions<[$O['exact'], false]> extends true
84
84
  ? $IsDistributive<$O, { $then: _D<T, $O>; $else: _N<T, $O> }>
85
85
  : NotAssignable.$<T, number, $O>
86
- export type $UtilOptions = NotAssignable.$UtilOptions & $Exact.$Options
86
+ export type $UtilOptions = NotAssignable.$UtilOptions & $ExactOptions
87
87
  export type _D<T, $O extends IsNotNumber.$Options> = T extends number & infer U
88
88
  ? U extends number
89
89
  ? $ResolveBranch<T, $O, [$Then]>
@@ -3,7 +3,7 @@ import type { $Equality } from '../type_plus/$equality.js'
3
3
  import type { $MergeOptions } from '../type_plus/$merge_options.js'
4
4
  import type { $ResolveOptions } from '../type_plus/$resolve_options.js'
5
5
  import type { $SpecialType } from '../type_plus/$special_type.js'
6
- import type { $Exact } from '../type_plus/branch/$exact.js'
6
+ import type { $ExactOptions } from '../type_plus/branch/$exact.js'
7
7
  import type { $IsDistributive } from '../type_plus/branch/$is_distributive.js'
8
8
  import type { $ResolveBranch } from '../type_plus/branch/$resolve_branch.js'
9
9
  import type { $Else, $Then } from '../type_plus/branch/$selection.js'
@@ -72,7 +72,7 @@ export type IsNumber<T, $O extends IsNumber.$Options = {}> = $SpecialType<
72
72
  >
73
73
 
74
74
  export namespace IsNumber {
75
- export type $Options = $Equality.$Options & $Exact.$Options
75
+ export type $Options = $Equality.$Options & $ExactOptions
76
76
  export type $Branch<$O extends $Options = {}> = $Equality.$Branch<$O>
77
77
 
78
78
  /**
@@ -86,7 +86,7 @@ export namespace IsNumber {
86
86
  export type $<T, $O extends $UtilOptions> = $ResolveOptions<[$O['exact'], false]> extends true
87
87
  ? $IsDistributive<$O, { $then: _D<T, $O>; $else: _N<T, $O> }>
88
88
  : Assignable.$<T, number, $O>
89
- export type $UtilOptions = Assignable.$UtilOptions & $Exact.$Options
89
+ export type $UtilOptions = Assignable.$UtilOptions & $ExactOptions
90
90
 
91
91
  export type _D<T, $O extends $UtilOptions> = T extends number & infer U
92
92
  ? U extends number
@@ -0,0 +1,14 @@
1
+ import type { AnyRecord } from './any_record.js'
2
+ import type { OptionalKeys } from './optional_key.js'
3
+ import type { RequiredKeys } from './RequiredKeys.js'
4
+
5
+ /**
6
+ * ⚗️ *transform*
7
+ *
8
+ * Adjust `T` to work with compiler flag [exactOptionalPropertyTypes](https://www.typescriptlang.org/tsconfig/#exactOptionalPropertyTypes).
9
+ *
10
+ * It adds `undefined` to optional properties.
11
+ */
12
+ export type AdjustExactOptionalProps<T extends AnyRecord> = T extends object
13
+ ? { [K in OptionalKeys<T>]?: T[K] | undefined } & { [K in RequiredKeys<T>]: T[K] }
14
+ : never
@@ -1,3 +1,4 @@
1
+ export type * from './adjust_exact_optional_props.js'
1
2
  export type { ANotB, BNotA } from './ANotB.js'
2
3
  export type { AnyRecord } from './any_record.js'
3
4
  export * from './everyKey.js'
@@ -5,7 +5,7 @@ import type { $Equality } from '../type_plus/$equality.js'
5
5
  import type { $MergeOptions } from '../type_plus/$merge_options.js'
6
6
  import type { $ResolveOptions } from '../type_plus/$resolve_options.js'
7
7
  import type { $SpecialType } from '../type_plus/$special_type.js'
8
- import type { $Exact } from '../type_plus/branch/$exact.js'
8
+ import type { $ExactDefault, $ExactOptions } from '../type_plus/branch/$exact.js'
9
9
  import type { $IsDistributive } from '../type_plus/branch/$is_distributive.js'
10
10
  import type { $ResolveBranch } from '../type_plus/branch/$resolve_branch.js'
11
11
  import type { $Else, $Then } from '../type_plus/branch/$selection.js'
@@ -100,7 +100,7 @@ export type IsNotObject<T, $O extends IsNotObject.$Options = {}> = $SpecialType<
100
100
  >
101
101
  >
102
102
  export namespace IsNotObject {
103
- export type $Options = $Equality.$Options & $Exact.$Options
103
+ export type $Options = $Equality.$Options & $ExactOptions
104
104
  export type $Branch<$O extends $Options = {}> = $Equality.$Branch<$O>
105
105
 
106
106
  /**
@@ -111,10 +111,10 @@ export namespace IsNotObject {
111
111
  * This is a type util for building custom types.
112
112
  * It does not check against special types.
113
113
  */
114
- export type $<T, $O extends $UtilOptions> = $ResolveOptions<[$O['exact'], $Exact.$Default]> extends true
114
+ export type $<T, $O extends $UtilOptions> = $ResolveOptions<[$O['exact'], $ExactDefault]> extends true
115
115
  ? $IsDistributive<$O, { $then: _D<T, $O>; $else: _N<T, $O> }>
116
116
  : NotAssignable.$<T, object, $O>
117
- export type $UtilOptions = NotAssignable.$UtilOptions & $Exact.$Options
117
+ export type $UtilOptions = NotAssignable.$UtilOptions & $ExactOptions
118
118
 
119
119
  export type _D<T, $O extends $UtilOptions> = T extends object
120
120
  ? IdentityEqual<
@@ -5,7 +5,7 @@ import type { $Equality } from '../type_plus/$equality.js'
5
5
  import type { $MergeOptions } from '../type_plus/$merge_options.js'
6
6
  import type { $ResolveOptions } from '../type_plus/$resolve_options.js'
7
7
  import type { $SpecialType } from '../type_plus/$special_type.js'
8
- import type { $Exact } from '../type_plus/branch/$exact.js'
8
+ import type { $ExactDefault, $ExactOptions } from '../type_plus/branch/$exact.js'
9
9
  import type { $IsDistributive } from '../type_plus/branch/$is_distributive.js'
10
10
  import type { $ResolveBranch } from '../type_plus/branch/$resolve_branch.js'
11
11
  import type { $Else, $Then } from '../type_plus/branch/$selection.js'
@@ -88,7 +88,7 @@ export type IsObject<T, $O extends IsObject.$Options = {}> = $SpecialType<
88
88
  >
89
89
 
90
90
  export namespace IsObject {
91
- export type $Options = $Equality.$Options & $Exact.$Options
91
+ export type $Options = $Equality.$Options & $ExactOptions
92
92
  export type $Branch<$O extends $Options = {}> = $Equality.$Branch<$O>
93
93
 
94
94
  /**
@@ -99,10 +99,10 @@ export namespace IsObject {
99
99
  * This is a type util for building custom types.
100
100
  * It does not check against special types.
101
101
  */
102
- export type $<T, $O extends $UtilOptions> = $ResolveOptions<[$O['exact'], $Exact.$Default]> extends true
102
+ export type $<T, $O extends $UtilOptions> = $ResolveOptions<[$O['exact'], $ExactDefault]> extends true
103
103
  ? $IsDistributive<$O, { $then: _D<T, $O>; $else: _N<T, $O> }>
104
104
  : Assignable.$<T, object, $O>
105
- export type $UtilOptions = Assignable.$UtilOptions & $Exact.$Options
105
+ export type $UtilOptions = Assignable.$UtilOptions & $ExactOptions
106
106
 
107
107
  export type _D<T, $O extends $UtilOptions> = T extends object
108
108
  ? IdentityEqual<
@@ -3,7 +3,7 @@ import type { $Equality } from '../type_plus/$equality.js'
3
3
  import type { $MergeOptions } from '../type_plus/$merge_options.js'
4
4
  import type { $ResolveOptions } from '../type_plus/$resolve_options.js'
5
5
  import type { $SpecialType } from '../type_plus/$special_type.js'
6
- import type { $Exact } from '../type_plus/branch/$exact.js'
6
+ import type { $ExactOptions } from '../type_plus/branch/$exact.js'
7
7
  import type { $IsDistributive } from '../type_plus/branch/$is_distributive.js'
8
8
  import type { $ResolveBranch } from '../type_plus/branch/$resolve_branch.js'
9
9
  import type { $Else, $Then } from '../type_plus/branch/$selection.js'
@@ -69,7 +69,7 @@ export type IsNotString<T, $O extends IsNotString.$Options = {}> = $SpecialType<
69
69
  >
70
70
 
71
71
  export namespace IsNotString {
72
- export type $Options = $Equality.$Options & $Exact.$Options
72
+ export type $Options = $Equality.$Options & $ExactOptions
73
73
  export type $Branch<$O extends $Options = {}> = $Equality.$Branch<$O>
74
74
 
75
75
  /**
@@ -83,7 +83,7 @@ export namespace IsNotString {
83
83
  export type $<T, $O extends $UtilOptions> = $ResolveOptions<[$O['exact'], false]> extends true
84
84
  ? $IsDistributive<$O, { $then: _D<T, $O>; $else: _N<T, $O> }>
85
85
  : NotAssignable.$<T, string, $O>
86
- export type $UtilOptions = NotAssignable.$UtilOptions & $Exact.$Options
86
+ export type $UtilOptions = NotAssignable.$UtilOptions & $ExactOptions
87
87
 
88
88
  export type _D<T, $O extends $SelectionOptions> = T extends string & infer U
89
89
  ? U extends string
@@ -3,7 +3,7 @@ import type { $Equality } from '../type_plus/$equality.js'
3
3
  import type { $MergeOptions } from '../type_plus/$merge_options.js'
4
4
  import type { $ResolveOptions } from '../type_plus/$resolve_options.js'
5
5
  import type { $SpecialType } from '../type_plus/$special_type.js'
6
- import type { $Exact } from '../type_plus/branch/$exact.js'
6
+ import type { $ExactDefault, $ExactOptions } from '../type_plus/branch/$exact.js'
7
7
  import type { $IsDistributive } from '../type_plus/branch/$is_distributive.js'
8
8
  import type { $ResolveBranch } from '../type_plus/branch/$resolve_branch.js'
9
9
  import type { $Else, $Then } from '../type_plus/branch/$selection.js'
@@ -80,7 +80,7 @@ export type IsNotStringLiteral<T, $O extends IsNotStringLiteral.$Options = {}> =
80
80
  >
81
81
 
82
82
  export namespace IsNotStringLiteral {
83
- export type $Options = $Equality.$Options & $Exact.$Options
83
+ export type $Options = $Equality.$Options & $ExactOptions
84
84
  export type $Branch<$O extends $Options = {}> = $Equality.$Branch<$O>
85
85
 
86
86
  /**
@@ -91,11 +91,11 @@ export namespace IsNotStringLiteral {
91
91
  * This is a type util for building custom types.
92
92
  * It does not check against special types.
93
93
  */
94
- export type $<T, $O extends $UtilOptions> = $ResolveOptions<[$O['exact'], $Exact.$Default]> extends true
94
+ export type $<T, $O extends $UtilOptions> = $ResolveOptions<[$O['exact'], $ExactDefault]> extends true
95
95
  ? $IsDistributive<$O, { $then: _ED<T, $O>; $else: _EN<T, $O> }>
96
96
  : $IsDistributive<$O, { $then: _D<T, $O>; $else: _N<T, $O> }>
97
97
 
98
- export type $UtilOptions = Assignable.$UtilOptions & $Exact.$Options
98
+ export type $UtilOptions = Assignable.$UtilOptions & $ExactOptions
99
99
 
100
100
  export type _ED<T, $O extends $SelectionOptions> = T extends string ? _E<T, $O> : $ResolveBranch<T, $O, [$Then]>
101
101
 
@@ -3,7 +3,7 @@ import type { $Equality } from '../type_plus/$equality.js'
3
3
  import type { $MergeOptions } from '../type_plus/$merge_options.js'
4
4
  import type { $ResolveOptions } from '../type_plus/$resolve_options.js'
5
5
  import type { $SpecialType } from '../type_plus/$special_type.js'
6
- import type { $Exact } from '../type_plus/branch/$exact.js'
6
+ import type { $ExactOptions } from '../type_plus/branch/$exact.js'
7
7
  import type { $IsDistributive } from '../type_plus/branch/$is_distributive.js'
8
8
  import type { $ResolveBranch } from '../type_plus/branch/$resolve_branch.js'
9
9
  import type { $Else, $Then } from '../type_plus/branch/$selection.js'
@@ -68,7 +68,7 @@ export type IsString<T, $O extends IsString.$Options = {}> = $SpecialType<
68
68
  >
69
69
 
70
70
  export namespace IsString {
71
- export type $Options = $Equality.$Options & $Exact.$Options
71
+ export type $Options = $Equality.$Options & $ExactOptions
72
72
  export type $Branch<$O extends $Options = {}> = $Equality.$Branch<$O>
73
73
 
74
74
  /**
@@ -83,7 +83,7 @@ export namespace IsString {
83
83
  ? $IsDistributive<$O, { $then: _D<T, $O>; $else: _N<T, $O> }>
84
84
  : Assignable.$<T, string, $O>
85
85
 
86
- export type $UtilOptions = Assignable.$UtilOptions & $Exact.$Options
86
+ export type $UtilOptions = Assignable.$UtilOptions & $ExactOptions
87
87
 
88
88
  export type _D<T, $O extends $UtilOptions> = T extends string & infer U
89
89
  ? U extends string
@@ -3,7 +3,7 @@ import type { $Equality } from '../type_plus/$equality.js'
3
3
  import type { $MergeOptions } from '../type_plus/$merge_options.js'
4
4
  import type { $ResolveOptions } from '../type_plus/$resolve_options.js'
5
5
  import type { $SpecialType } from '../type_plus/$special_type.js'
6
- import type { $Exact } from '../type_plus/branch/$exact.js'
6
+ import type { $ExactDefault, $ExactOptions } from '../type_plus/branch/$exact.js'
7
7
  import type { $IsDistributive } from '../type_plus/branch/$is_distributive.js'
8
8
  import type { $ResolveBranch } from '../type_plus/branch/$resolve_branch.js'
9
9
  import type { $Else, $Then } from '../type_plus/branch/$selection.js'
@@ -80,7 +80,7 @@ export type IsStringLiteral<T, $O extends IsStringLiteral.$Options = {}> = $Spec
80
80
  >
81
81
 
82
82
  export namespace IsStringLiteral {
83
- export type $Options = $Equality.$Options & $Exact.$Options
83
+ export type $Options = $Equality.$Options & $ExactOptions
84
84
  export type $Branch<$O extends $Options = {}> = $Equality.$Branch<$O>
85
85
 
86
86
  /**
@@ -91,11 +91,11 @@ export namespace IsStringLiteral {
91
91
  * This is a type util for building custom types.
92
92
  * It does not check against special types.
93
93
  */
94
- export type $<T, $O extends $UtilOptions> = $ResolveOptions<[$O['exact'], $Exact.$Default]> extends true
94
+ export type $<T, $O extends $UtilOptions> = $ResolveOptions<[$O['exact'], $ExactDefault]> extends true
95
95
  ? $IsDistributive<$O, { $then: _ED<T, $O>; $else: _EN<T, $O> }>
96
96
  : $IsDistributive<$O, { $then: _D<T, $O>; $else: _N<T, $O> }>
97
97
 
98
- export type $UtilOptions = Assignable.$UtilOptions & $Exact.$Options
98
+ export type $UtilOptions = Assignable.$UtilOptions & $ExactOptions
99
99
 
100
100
  export type _ED<T, $O extends $SelectionOptions> = T extends string ? _E<T, $O> : $ResolveBranch<T, $O, [$Else]>
101
101
 
@@ -1,38 +1,28 @@
1
1
  import type { $ResolveOptions } from '../$resolve_options.js'
2
- import type { $Branch } from './$branch.js'
3
2
  import type { $InputOptions } from './$input_options.js'
4
3
  import type { $Else, $Then } from './$selection.js'
5
4
 
6
5
  /**
7
6
  * 🧰 *type util*
8
7
  *
9
- * Branch to handle exact comparison.
8
+ * `$Exact.$Options` enables customizing the behavior of the `$exact` branch.
9
+ *
10
+ * The `$exact` branch is used to handle when it is an exact comparison.
10
11
  */
11
- export type $Exact = $Branch<'$exact'>
12
-
13
- export namespace $Exact {
14
- /**
15
- * 🧰 *type util*
16
- *
17
- * `$Exact.$Options` enables customizing the behavior of the `$exact` branch.
18
- *
19
- * The `$exact` branch is used to handle when it is an exact comparison.
20
- */
21
- export type $Options = {
22
- exact?: boolean | undefined
23
- }
24
-
25
- export type $Default = {
26
- exact: false
27
- }
12
+ export type $ExactOptions = {
13
+ exact?: boolean | undefined
14
+ }
28
15
 
29
- export type $IsExact<$Opt extends $Options, $O extends $InputOptions<$Then | $Else> = {}> = $ResolveOptions<
30
- [$Opt['exact'], $Exact.$Default]
31
- > extends true
32
- ? '$then' extends keyof $O
33
- ? $O['$then']
34
- : true
35
- : '$else' extends keyof $O
36
- ? $O['$else']
37
- : false
16
+ export type $ExactDefault = {
17
+ exact: false
38
18
  }
19
+
20
+ export type $IsExact<$Opt extends $ExactOptions, $O extends $InputOptions<$Then | $Else> = {}> = $ResolveOptions<
21
+ [$Opt['exact'], $ExactDefault]
22
+ > extends true
23
+ ? '$then' extends keyof $O
24
+ ? $O['$then']
25
+ : true
26
+ : '$else' extends keyof $O
27
+ ? $O['$else']
28
+ : false
@@ -1,9 +1,9 @@
1
+ import type { $SpecialType } from '../$special_type.js'
1
2
  import type { $Any } from '../../any/any.js'
2
3
  import type { $Never } from '../../never/never.js'
3
4
  import type { $Unknown } from '../../unknown/unknown.js'
4
- import type { $SpecialType } from '../$special_type.js'
5
5
  import type { $DistributiveDefault, $DistributiveOptions } from './$distributive.js'
6
- import type { $Exact } from './$exact.js'
6
+ import type { $ExactOptions } from './$exact.js'
7
7
  import type { $InputOptions } from './$input_options.js'
8
8
  import type { $IsDistributive } from './$is_distributive.js'
9
9
  import type { $ResolveBranch } from './$resolve_branch.js'
@@ -75,7 +75,7 @@ export namespace $Select {
75
75
  export type $Options = $SelectionOptions &
76
76
  $DistributiveOptions &
77
77
  $InputOptions<$Any | $Unknown | $Never> &
78
- $Exact.$Options
78
+ $ExactOptions
79
79
  export type $Default = $SelectionPredicate & $DistributiveDefault
80
80
  export type $Branch<$O extends $DistributiveOptions = $DistributiveDefault> = $SelectionBranch & $O
81
81
  export type _<T, U, $O extends $Select.$Options> = $IsDistributive<$O> extends true ? _D<T, U, $O> : _N<T, U, $O>
@@ -0,0 +1,5 @@
1
+ /**
2
+ * 🧰 *type util*
3
+ * Define a union type that is a subset of union type.
4
+ */
5
+ export type SubUnion<U, T extends U> = T