@sinclair/typebox 0.32.0-dev-15 → 0.32.0-dev-17

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 (682) hide show
  1. package/build/import/compiler/compiler.d.mts +9 -0
  2. package/build/import/compiler/compiler.mjs +87 -6
  3. package/build/import/compiler/index.mjs +27 -0
  4. package/build/import/errors/errors.d.mts +3 -0
  5. package/build/import/errors/errors.mjs +55 -3
  6. package/build/import/errors/function.d.mts +3 -0
  7. package/build/import/errors/function.mjs +31 -0
  8. package/build/import/errors/index.mjs +27 -0
  9. package/build/import/index.d.mts +2 -2
  10. package/build/import/index.mjs +38 -2
  11. package/build/import/system/index.mjs +27 -0
  12. package/build/import/system/policy.d.mts +10 -0
  13. package/build/import/system/policy.mjs +40 -0
  14. package/build/import/system/system.d.mts +3 -0
  15. package/build/import/system/system.mjs +36 -0
  16. package/build/import/type/any/any.d.mts +1 -0
  17. package/build/import/type/any/any.mjs +28 -0
  18. package/build/import/type/any/index.mjs +27 -0
  19. package/build/import/type/array/array.d.mts +8 -1
  20. package/build/import/type/array/array.mjs +28 -0
  21. package/build/import/type/array/index.mjs +27 -0
  22. package/build/import/type/async-iterator/async-iterator.d.mts +1 -0
  23. package/build/import/type/async-iterator/async-iterator.mjs +28 -0
  24. package/build/import/type/async-iterator/index.mjs +27 -0
  25. package/build/import/type/awaited/awaited.d.mts +1 -0
  26. package/build/import/type/awaited/awaited.mjs +37 -0
  27. package/build/import/type/awaited/index.mjs +27 -0
  28. package/build/import/type/bigint/bigint.d.mts +1 -0
  29. package/build/import/type/bigint/bigint.mjs +28 -0
  30. package/build/import/type/bigint/index.mjs +27 -0
  31. package/build/import/type/boolean/boolean.d.mts +1 -0
  32. package/build/import/type/boolean/boolean.mjs +28 -0
  33. package/build/import/type/boolean/index.mjs +27 -0
  34. package/build/import/type/clone/index.mjs +27 -0
  35. package/build/import/type/clone/type.d.mts +2 -0
  36. package/build/import/type/clone/type.mjs +29 -0
  37. package/build/import/type/clone/value.d.mts +1 -0
  38. package/build/import/type/clone/value.mjs +29 -0
  39. package/build/import/type/composite/composite.d.mts +1 -0
  40. package/build/import/type/composite/composite.mjs +28 -0
  41. package/build/import/type/composite/index.mjs +27 -0
  42. package/build/import/type/const/const.d.mts +2 -1
  43. package/build/import/type/const/const.mjs +32 -1
  44. package/build/import/type/const/index.mjs +27 -0
  45. package/build/import/type/constructor/constructor.d.mts +5 -4
  46. package/build/import/type/constructor/constructor.mjs +28 -0
  47. package/build/import/type/constructor/index.mjs +27 -0
  48. package/build/import/type/constructor-parameters/constructor-parameters.d.mts +1 -0
  49. package/build/import/type/constructor-parameters/constructor-parameters.mjs +28 -0
  50. package/build/import/type/constructor-parameters/index.mjs +27 -0
  51. package/build/import/type/date/date.d.mts +6 -0
  52. package/build/import/type/date/date.mjs +28 -0
  53. package/build/import/type/date/index.mjs +27 -0
  54. package/build/import/type/deref/deref.d.mts +1 -0
  55. package/build/import/type/deref/deref.mjs +45 -0
  56. package/build/import/type/deref/index.mjs +27 -0
  57. package/build/import/type/discard/discard.mjs +27 -0
  58. package/build/import/type/discard/index.mjs +27 -0
  59. package/build/import/type/enum/enum.d.mts +1 -0
  60. package/build/import/type/enum/enum.mjs +28 -0
  61. package/build/import/type/enum/index.mjs +27 -0
  62. package/build/import/type/exclude/exclude-from-mapped-result.mjs +30 -0
  63. package/build/import/type/exclude/exclude.d.mts +5 -3
  64. package/build/import/type/exclude/exclude.mjs +30 -0
  65. package/build/import/type/exclude/index.mjs +27 -0
  66. package/build/import/type/extends/extends-check.mjs +200 -1
  67. package/build/import/type/extends/extends-from-mapped-key.mjs +31 -0
  68. package/build/import/type/extends/extends-from-mapped-result.mjs +30 -0
  69. package/build/import/type/extends/extends-undefined.d.mts +1 -0
  70. package/build/import/type/extends/extends-undefined.mjs +30 -0
  71. package/build/import/type/extends/extends.d.mts +3 -0
  72. package/build/import/type/extends/extends.mjs +35 -1
  73. package/build/import/type/extends/index.mjs +27 -0
  74. package/build/import/type/extract/extract-from-mapped-result.mjs +30 -0
  75. package/build/import/type/extract/extract.d.mts +5 -3
  76. package/build/import/type/extract/extract.mjs +30 -0
  77. package/build/import/type/extract/index.mjs +27 -0
  78. package/build/import/type/function/function.d.mts +5 -4
  79. package/build/import/type/function/function.mjs +28 -0
  80. package/build/import/type/function/index.mjs +27 -0
  81. package/build/import/type/guard/index.mjs +27 -0
  82. package/build/import/type/guard/type.d.mts +46 -0
  83. package/build/import/type/guard/type.mjs +111 -1
  84. package/build/import/type/guard/value.d.mts +14 -0
  85. package/build/import/type/guard/value.mjs +41 -0
  86. package/build/import/type/helpers/helpers.d.mts +1 -0
  87. package/build/import/type/helpers/helpers.mjs +28 -0
  88. package/build/import/type/helpers/index.mjs +27 -0
  89. package/build/import/type/index.mjs +27 -0
  90. package/build/import/type/indexed/index.mjs +27 -0
  91. package/build/import/type/indexed/indexed-from-mapped-key.mjs +35 -1
  92. package/build/import/type/indexed/indexed-property-keys.d.mts +1 -0
  93. package/build/import/type/indexed/indexed-property-keys.mjs +36 -0
  94. package/build/import/type/indexed/indexed-result.d.mts +6 -6
  95. package/build/import/type/indexed/indexed-result.mjs +49 -7
  96. package/build/import/type/indexed/indexed.d.mts +3 -0
  97. package/build/import/type/indexed/indexed.mjs +34 -1
  98. package/build/import/type/instance-type/index.mjs +27 -0
  99. package/build/import/type/instance-type/instance-type.d.mts +1 -0
  100. package/build/import/type/instance-type/instance-type.mjs +28 -0
  101. package/build/import/type/integer/index.mjs +27 -0
  102. package/build/import/type/integer/integer.d.mts +1 -0
  103. package/build/import/type/integer/integer.mjs +28 -0
  104. package/build/import/type/intersect/index.d.mts +2 -0
  105. package/build/import/type/intersect/index.mjs +29 -0
  106. package/build/import/type/intersect/intersect-create.d.mts +3 -0
  107. package/build/import/type/intersect/intersect-create.mjs +47 -0
  108. package/build/import/type/intersect/intersect-evaluated.d.mts +17 -0
  109. package/build/import/type/intersect/intersect-evaluated.mjs +71 -0
  110. package/build/import/type/intersect/intersect-type.d.mts +15 -0
  111. package/build/import/type/intersect/intersect-type.mjs +28 -0
  112. package/build/import/type/intersect/intersect.d.mts +5 -20
  113. package/build/import/type/intersect/intersect.mjs +37 -17
  114. package/build/import/type/intrinsic/capitalize.d.mts +1 -0
  115. package/build/import/type/intrinsic/capitalize.mjs +28 -0
  116. package/build/import/type/intrinsic/index.mjs +27 -0
  117. package/build/import/type/intrinsic/intrinsic-from-mapped-key.mjs +31 -0
  118. package/build/import/type/intrinsic/intrinsic.d.mts +2 -0
  119. package/build/import/type/intrinsic/intrinsic.mjs +43 -1
  120. package/build/import/type/intrinsic/lowercase.d.mts +1 -0
  121. package/build/import/type/intrinsic/lowercase.mjs +28 -0
  122. package/build/import/type/intrinsic/uncapitalize.d.mts +1 -0
  123. package/build/import/type/intrinsic/uncapitalize.mjs +28 -0
  124. package/build/import/type/intrinsic/uppercase.d.mts +1 -0
  125. package/build/import/type/intrinsic/uppercase.mjs +28 -0
  126. package/build/import/type/iterator/index.mjs +27 -0
  127. package/build/import/type/iterator/iterator.d.mts +1 -0
  128. package/build/import/type/iterator/iterator.mjs +28 -0
  129. package/build/import/type/keyof/index.mjs +27 -0
  130. package/build/import/type/keyof/keyof-from-mapped-result.mjs +30 -0
  131. package/build/import/type/keyof/keyof-property-keys.d.mts +2 -0
  132. package/build/import/type/keyof/keyof-property-keys.mjs +47 -0
  133. package/build/import/type/keyof/keyof.d.mts +4 -2
  134. package/build/import/type/keyof/keyof.mjs +35 -2
  135. package/build/import/type/literal/index.mjs +27 -0
  136. package/build/import/type/literal/literal.d.mts +1 -0
  137. package/build/import/type/literal/literal.mjs +28 -0
  138. package/build/import/type/mapped/index.mjs +27 -0
  139. package/build/import/type/mapped/mapped-key.mjs +28 -0
  140. package/build/import/type/mapped/mapped-result.mjs +28 -0
  141. package/build/import/type/mapped/mapped.d.mts +2 -0
  142. package/build/import/type/mapped/mapped.mjs +47 -3
  143. package/build/import/type/modifiers/index.mjs +27 -0
  144. package/build/import/type/modifiers/modifiers.mjs +37 -0
  145. package/build/import/type/never/index.mjs +27 -0
  146. package/build/import/type/never/never.d.mts +1 -0
  147. package/build/import/type/never/never.mjs +28 -0
  148. package/build/import/type/not/index.mjs +27 -0
  149. package/build/import/type/not/not.d.mts +1 -0
  150. package/build/import/type/not/not.mjs +28 -0
  151. package/build/import/type/null/index.mjs +27 -0
  152. package/build/import/type/null/null.d.mts +1 -0
  153. package/build/import/type/null/null.mjs +28 -0
  154. package/build/import/type/number/index.mjs +27 -0
  155. package/build/import/type/number/number.d.mts +1 -0
  156. package/build/import/type/number/number.mjs +28 -0
  157. package/build/import/type/object/index.mjs +27 -0
  158. package/build/import/type/object/object.d.mts +10 -5
  159. package/build/import/type/object/object.mjs +33 -0
  160. package/build/import/type/omit/index.mjs +27 -0
  161. package/build/import/type/omit/omit-from-mapped-key.mjs +31 -0
  162. package/build/import/type/omit/omit.d.mts +3 -0
  163. package/build/import/type/omit/omit.mjs +39 -0
  164. package/build/import/type/operators/index.mjs +27 -0
  165. package/build/import/type/operators/operators.d.mts +8 -0
  166. package/build/import/type/operators/operators.mjs +42 -0
  167. package/build/import/type/optional/index.mjs +27 -0
  168. package/build/import/type/optional/optional.d.mts +1 -0
  169. package/build/import/type/optional/optional.mjs +28 -0
  170. package/build/import/type/parameters/index.mjs +27 -0
  171. package/build/import/type/parameters/parameters.d.mts +1 -0
  172. package/build/import/type/parameters/parameters.mjs +28 -0
  173. package/build/import/type/partial/index.mjs +27 -0
  174. package/build/import/type/partial/partial-from-mapped-result.mjs +30 -0
  175. package/build/import/type/partial/partial.d.mts +2 -0
  176. package/build/import/type/partial/partial.mjs +36 -0
  177. package/build/import/type/patterns/index.mjs +27 -0
  178. package/build/import/type/patterns/patterns.mjs +27 -0
  179. package/build/import/type/pick/index.mjs +27 -0
  180. package/build/import/type/pick/pick-from-mapped-key.mjs +31 -0
  181. package/build/import/type/pick/pick.d.mts +3 -0
  182. package/build/import/type/pick/pick.mjs +34 -0
  183. package/build/import/type/promise/index.mjs +27 -0
  184. package/build/import/type/promise/promise.d.mts +1 -0
  185. package/build/import/type/promise/promise.mjs +28 -0
  186. package/build/import/type/readonly/index.mjs +27 -0
  187. package/build/import/type/readonly/readonly.d.mts +1 -0
  188. package/build/import/type/readonly/readonly.mjs +28 -0
  189. package/build/import/type/readonly-optional/index.mjs +27 -0
  190. package/build/import/type/readonly-optional/readonly-optional.d.mts +1 -0
  191. package/build/import/type/readonly-optional/readonly-optional.mjs +28 -0
  192. package/build/import/type/record/index.mjs +27 -0
  193. package/build/import/type/record/record.d.mts +1 -1
  194. package/build/import/type/record/record.mjs +49 -1
  195. package/build/import/type/recursive/index.mjs +27 -0
  196. package/build/import/type/recursive/recursive.d.mts +4 -2
  197. package/build/import/type/recursive/recursive.mjs +31 -5
  198. package/build/import/type/ref/index.mjs +27 -0
  199. package/build/import/type/ref/ref.d.mts +2 -0
  200. package/build/import/type/ref/ref.mjs +28 -0
  201. package/build/import/type/regexp/index.mjs +27 -0
  202. package/build/import/type/regexp/regexp.d.mts +2 -0
  203. package/build/import/type/regexp/regexp.mjs +28 -0
  204. package/build/import/type/registry/format.d.mts +6 -0
  205. package/build/import/type/registry/format.mjs +34 -0
  206. package/build/import/type/registry/index.mjs +27 -0
  207. package/build/import/type/registry/type.d.mts +6 -0
  208. package/build/import/type/registry/type.mjs +34 -0
  209. package/build/import/type/required/index.mjs +27 -0
  210. package/build/import/type/required/required-from-mapped-result.mjs +30 -0
  211. package/build/import/type/required/required.d.mts +2 -0
  212. package/build/import/type/required/required.mjs +36 -0
  213. package/build/import/type/rest/index.mjs +27 -0
  214. package/build/import/type/rest/rest.d.mts +1 -0
  215. package/build/import/type/rest/rest.mjs +32 -0
  216. package/build/import/type/return-type/index.mjs +27 -0
  217. package/build/import/type/return-type/return-type.d.mts +1 -0
  218. package/build/import/type/return-type/return-type.mjs +28 -0
  219. package/build/import/type/schema/anyschema.mjs +27 -0
  220. package/build/import/type/schema/index.mjs +27 -0
  221. package/build/import/type/schema/schema.d.mts +7 -0
  222. package/build/import/type/schema/schema.mjs +27 -0
  223. package/build/import/type/static/index.mjs +27 -0
  224. package/build/import/type/static/static.d.mts +3 -0
  225. package/build/import/type/static/static.mjs +27 -0
  226. package/build/import/type/strict/index.mjs +27 -0
  227. package/build/import/type/strict/strict.d.mts +1 -0
  228. package/build/import/type/strict/strict.mjs +28 -0
  229. package/build/import/type/string/index.mjs +27 -0
  230. package/build/import/type/string/string.d.mts +7 -0
  231. package/build/import/type/string/string.mjs +28 -0
  232. package/build/import/type/symbol/index.mjs +27 -0
  233. package/build/import/type/symbol/symbol.d.mts +1 -0
  234. package/build/import/type/symbol/symbol.mjs +28 -0
  235. package/build/import/type/symbols/index.mjs +27 -0
  236. package/build/import/type/symbols/symbols.d.mts +5 -0
  237. package/build/import/type/symbols/symbols.mjs +32 -0
  238. package/build/import/type/template-literal/finite.mjs +37 -0
  239. package/build/import/type/template-literal/generate.mjs +37 -0
  240. package/build/import/type/template-literal/index.mjs +27 -0
  241. package/build/import/type/template-literal/parser.d.mts +2 -0
  242. package/build/import/type/template-literal/parser.mjs +44 -0
  243. package/build/import/type/template-literal/pattern.mjs +38 -0
  244. package/build/import/type/template-literal/syntax.d.mts +5 -4
  245. package/build/import/type/template-literal/syntax.mjs +35 -0
  246. package/build/import/type/template-literal/template-literal.d.mts +6 -4
  247. package/build/import/type/template-literal/template-literal.mjs +29 -0
  248. package/build/import/type/template-literal/union.d.mts +1 -0
  249. package/build/import/type/template-literal/union.mjs +31 -0
  250. package/build/import/type/transform/index.mjs +27 -0
  251. package/build/import/type/transform/transform.d.mts +4 -2
  252. package/build/import/type/transform/transform.mjs +37 -1
  253. package/build/import/type/tuple/index.mjs +27 -0
  254. package/build/import/type/tuple/tuple.d.mts +4 -3
  255. package/build/import/type/tuple/tuple.mjs +30 -0
  256. package/build/import/type/type/index.d.mts +1 -0
  257. package/build/import/type/type/index.mjs +34 -0
  258. package/build/import/type/type/javascript.d.mts +19 -0
  259. package/build/import/type/type/javascript.mjs +45 -0
  260. package/build/import/type/type/json.d.mts +66 -5
  261. package/build/import/type/type/json.mjs +82 -1
  262. package/build/import/type/type/type.mjs +30 -0
  263. package/build/import/type/uint8array/index.mjs +27 -0
  264. package/build/import/type/uint8array/uint8array.d.mts +1 -0
  265. package/build/import/type/uint8array/uint8array.mjs +28 -0
  266. package/build/import/type/undefined/index.mjs +27 -0
  267. package/build/import/type/undefined/undefined.d.mts +1 -0
  268. package/build/import/type/undefined/undefined.mjs +28 -0
  269. package/build/import/type/union/index.d.mts +2 -0
  270. package/build/import/type/union/index.mjs +29 -0
  271. package/build/import/type/union/union-create.d.mts +3 -0
  272. package/build/import/type/union/union-create.mjs +32 -0
  273. package/build/import/type/union/union-evaluated.d.mts +17 -0
  274. package/build/import/type/union/union-evaluated.mjs +68 -0
  275. package/build/import/type/union/union-type.d.mts +12 -0
  276. package/build/import/type/union/union-type.mjs +28 -0
  277. package/build/import/type/union/union.d.mts +4 -13
  278. package/build/import/type/union/union.mjs +32 -10
  279. package/build/import/type/unknown/index.mjs +27 -0
  280. package/build/import/type/unknown/unknown.d.mts +1 -0
  281. package/build/import/type/unknown/unknown.mjs +28 -0
  282. package/build/import/type/unsafe/index.mjs +27 -0
  283. package/build/import/type/unsafe/unsafe.d.mts +1 -0
  284. package/build/import/type/unsafe/unsafe.mjs +28 -0
  285. package/build/import/type/void/index.mjs +27 -0
  286. package/build/import/type/void/void.d.mts +1 -0
  287. package/build/import/type/void/void.mjs +28 -0
  288. package/build/import/value/cast/cast.d.mts +2 -0
  289. package/build/import/value/cast/cast.mjs +55 -0
  290. package/build/import/value/cast/index.mjs +27 -0
  291. package/build/import/value/check/check.d.mts +2 -0
  292. package/build/import/value/check/check.mjs +46 -1
  293. package/build/import/value/check/index.mjs +27 -0
  294. package/build/import/value/clean/clean.d.mts +2 -0
  295. package/build/import/value/clean/clean.mjs +39 -1
  296. package/build/import/value/clean/index.mjs +27 -0
  297. package/build/import/value/clone/clone.d.mts +1 -0
  298. package/build/import/value/clone/clone.mjs +34 -0
  299. package/build/import/value/clone/index.mjs +27 -0
  300. package/build/import/value/convert/convert.d.mts +2 -0
  301. package/build/import/value/convert/convert.mjs +57 -1
  302. package/build/import/value/convert/index.mjs +27 -0
  303. package/build/import/value/create/create.d.mts +2 -0
  304. package/build/import/value/create/create.mjs +44 -0
  305. package/build/import/value/create/index.mjs +27 -0
  306. package/build/import/value/default/default.d.mts +2 -0
  307. package/build/import/value/default/default.mjs +46 -0
  308. package/build/import/value/default/index.mjs +27 -0
  309. package/build/import/value/delta/delta.d.mts +1 -1
  310. package/build/import/value/delta/delta.mjs +42 -0
  311. package/build/import/value/delta/index.mjs +27 -0
  312. package/build/import/value/deref/deref.d.mts +1 -0
  313. package/build/import/value/deref/deref.mjs +28 -0
  314. package/build/import/value/deref/index.mjs +27 -0
  315. package/build/import/value/equal/equal.d.mts +1 -0
  316. package/build/import/value/equal/equal.mjs +34 -0
  317. package/build/import/value/equal/index.mjs +27 -0
  318. package/build/import/value/guard/guard.d.mts +20 -0
  319. package/build/import/value/guard/guard.mjs +57 -0
  320. package/build/import/value/guard/index.mjs +27 -0
  321. package/build/import/value/hash/hash.d.mts +1 -0
  322. package/build/import/value/hash/hash.mjs +46 -0
  323. package/build/import/value/hash/index.mjs +27 -0
  324. package/build/import/value/index.mjs +39 -0
  325. package/build/import/value/mutate/index.mjs +27 -0
  326. package/build/import/value/mutate/mutate.d.mts +1 -0
  327. package/build/import/value/mutate/mutate.mjs +38 -0
  328. package/build/import/value/pointer/index.mjs +27 -0
  329. package/build/import/value/pointer/pointer.d.mts +5 -0
  330. package/build/import/value/pointer/pointer.mjs +45 -0
  331. package/build/import/value/transform/decode.d.mts +5 -0
  332. package/build/import/value/transform/decode.mjs +50 -0
  333. package/build/import/value/transform/encode.d.mts +6 -0
  334. package/build/import/value/transform/encode.mjs +52 -0
  335. package/build/import/value/transform/has.d.mts +1 -0
  336. package/build/import/value/transform/has.mjs +43 -0
  337. package/build/import/value/transform/index.mjs +27 -0
  338. package/build/import/value/value/index.mjs +27 -0
  339. package/build/import/value/value/value.d.mts +24 -0
  340. package/build/import/value/value/value.mjs +42 -0
  341. package/build/require/compiler/compiler.d.ts +9 -0
  342. package/build/require/compiler/compiler.js +87 -6
  343. package/build/require/compiler/index.js +27 -0
  344. package/build/require/errors/errors.d.ts +3 -0
  345. package/build/require/errors/errors.js +55 -3
  346. package/build/require/errors/function.d.ts +3 -0
  347. package/build/require/errors/function.js +31 -0
  348. package/build/require/errors/index.js +27 -0
  349. package/build/require/index.d.ts +2 -2
  350. package/build/require/index.js +41 -2
  351. package/build/require/system/index.js +27 -0
  352. package/build/require/system/policy.d.ts +10 -0
  353. package/build/require/system/policy.js +40 -0
  354. package/build/require/system/system.d.ts +3 -0
  355. package/build/require/system/system.js +36 -0
  356. package/build/require/type/any/any.d.ts +1 -0
  357. package/build/require/type/any/any.js +28 -0
  358. package/build/require/type/any/index.js +27 -0
  359. package/build/require/type/array/array.d.ts +8 -1
  360. package/build/require/type/array/array.js +28 -0
  361. package/build/require/type/array/index.js +27 -0
  362. package/build/require/type/async-iterator/async-iterator.d.ts +1 -0
  363. package/build/require/type/async-iterator/async-iterator.js +28 -0
  364. package/build/require/type/async-iterator/index.js +27 -0
  365. package/build/require/type/awaited/awaited.d.ts +1 -0
  366. package/build/require/type/awaited/awaited.js +37 -0
  367. package/build/require/type/awaited/index.js +27 -0
  368. package/build/require/type/bigint/bigint.d.ts +1 -0
  369. package/build/require/type/bigint/bigint.js +28 -0
  370. package/build/require/type/bigint/index.js +27 -0
  371. package/build/require/type/boolean/boolean.d.ts +1 -0
  372. package/build/require/type/boolean/boolean.js +28 -0
  373. package/build/require/type/boolean/index.js +27 -0
  374. package/build/require/type/clone/index.js +27 -0
  375. package/build/require/type/clone/type.d.ts +2 -0
  376. package/build/require/type/clone/type.js +29 -0
  377. package/build/require/type/clone/value.d.ts +1 -0
  378. package/build/require/type/clone/value.js +29 -0
  379. package/build/require/type/composite/composite.d.ts +1 -0
  380. package/build/require/type/composite/composite.js +28 -0
  381. package/build/require/type/composite/index.js +27 -0
  382. package/build/require/type/const/const.d.ts +2 -1
  383. package/build/require/type/const/const.js +32 -1
  384. package/build/require/type/const/index.js +27 -0
  385. package/build/require/type/constructor/constructor.d.ts +5 -4
  386. package/build/require/type/constructor/constructor.js +28 -0
  387. package/build/require/type/constructor/index.js +27 -0
  388. package/build/require/type/constructor-parameters/constructor-parameters.d.ts +1 -0
  389. package/build/require/type/constructor-parameters/constructor-parameters.js +28 -0
  390. package/build/require/type/constructor-parameters/index.js +27 -0
  391. package/build/require/type/date/date.d.ts +6 -0
  392. package/build/require/type/date/date.js +28 -0
  393. package/build/require/type/date/index.js +27 -0
  394. package/build/require/type/deref/deref.d.ts +1 -0
  395. package/build/require/type/deref/deref.js +45 -0
  396. package/build/require/type/deref/index.js +27 -0
  397. package/build/require/type/discard/discard.js +27 -0
  398. package/build/require/type/discard/index.js +27 -0
  399. package/build/require/type/enum/enum.d.ts +1 -0
  400. package/build/require/type/enum/enum.js +28 -0
  401. package/build/require/type/enum/index.js +27 -0
  402. package/build/require/type/exclude/exclude-from-mapped-result.js +30 -0
  403. package/build/require/type/exclude/exclude.d.ts +5 -3
  404. package/build/require/type/exclude/exclude.js +30 -0
  405. package/build/require/type/exclude/index.js +27 -0
  406. package/build/require/type/extends/extends-check.js +200 -1
  407. package/build/require/type/extends/extends-from-mapped-key.js +31 -0
  408. package/build/require/type/extends/extends-from-mapped-result.js +30 -0
  409. package/build/require/type/extends/extends-undefined.d.ts +1 -0
  410. package/build/require/type/extends/extends-undefined.js +30 -0
  411. package/build/require/type/extends/extends.d.ts +3 -0
  412. package/build/require/type/extends/extends.js +39 -5
  413. package/build/require/type/extends/index.js +27 -0
  414. package/build/require/type/extract/extract-from-mapped-result.js +30 -0
  415. package/build/require/type/extract/extract.d.ts +5 -3
  416. package/build/require/type/extract/extract.js +30 -0
  417. package/build/require/type/extract/index.js +27 -0
  418. package/build/require/type/function/function.d.ts +5 -4
  419. package/build/require/type/function/function.js +28 -0
  420. package/build/require/type/function/index.js +27 -0
  421. package/build/require/type/guard/index.js +27 -0
  422. package/build/require/type/guard/type.d.ts +46 -0
  423. package/build/require/type/guard/type.js +111 -1
  424. package/build/require/type/guard/value.d.ts +14 -0
  425. package/build/require/type/guard/value.js +41 -0
  426. package/build/require/type/helpers/helpers.d.ts +1 -0
  427. package/build/require/type/helpers/helpers.js +28 -0
  428. package/build/require/type/helpers/index.js +27 -0
  429. package/build/require/type/index.js +27 -0
  430. package/build/require/type/indexed/index.js +27 -0
  431. package/build/require/type/indexed/indexed-from-mapped-key.js +35 -1
  432. package/build/require/type/indexed/indexed-property-keys.d.ts +1 -0
  433. package/build/require/type/indexed/indexed-property-keys.js +36 -0
  434. package/build/require/type/indexed/indexed-result.d.ts +6 -6
  435. package/build/require/type/indexed/indexed-result.js +46 -4
  436. package/build/require/type/indexed/indexed.d.ts +3 -0
  437. package/build/require/type/indexed/indexed.js +37 -4
  438. package/build/require/type/instance-type/index.js +27 -0
  439. package/build/require/type/instance-type/instance-type.d.ts +1 -0
  440. package/build/require/type/instance-type/instance-type.js +28 -0
  441. package/build/require/type/integer/index.js +27 -0
  442. package/build/require/type/integer/integer.d.ts +1 -0
  443. package/build/require/type/integer/integer.js +28 -0
  444. package/build/require/type/intersect/index.d.ts +2 -0
  445. package/build/require/type/intersect/index.js +29 -0
  446. package/build/require/type/intersect/intersect-create.d.ts +3 -0
  447. package/build/require/type/intersect/intersect-create.js +51 -0
  448. package/build/require/type/intersect/intersect-evaluated.d.ts +17 -0
  449. package/build/require/type/intersect/intersect-evaluated.js +75 -0
  450. package/build/require/type/intersect/intersect-type.d.ts +15 -0
  451. package/build/require/type/intersect/intersect-type.js +30 -0
  452. package/build/require/type/intersect/intersect.d.ts +5 -20
  453. package/build/require/type/intersect/intersect.js +37 -18
  454. package/build/require/type/intrinsic/capitalize.d.ts +1 -0
  455. package/build/require/type/intrinsic/capitalize.js +28 -0
  456. package/build/require/type/intrinsic/index.js +27 -0
  457. package/build/require/type/intrinsic/intrinsic-from-mapped-key.js +31 -0
  458. package/build/require/type/intrinsic/intrinsic.d.ts +2 -0
  459. package/build/require/type/intrinsic/intrinsic.js +43 -1
  460. package/build/require/type/intrinsic/lowercase.d.ts +1 -0
  461. package/build/require/type/intrinsic/lowercase.js +28 -0
  462. package/build/require/type/intrinsic/uncapitalize.d.ts +1 -0
  463. package/build/require/type/intrinsic/uncapitalize.js +28 -0
  464. package/build/require/type/intrinsic/uppercase.d.ts +1 -0
  465. package/build/require/type/intrinsic/uppercase.js +28 -0
  466. package/build/require/type/iterator/index.js +27 -0
  467. package/build/require/type/iterator/iterator.d.ts +1 -0
  468. package/build/require/type/iterator/iterator.js +28 -0
  469. package/build/require/type/keyof/index.js +27 -0
  470. package/build/require/type/keyof/keyof-from-mapped-result.js +30 -0
  471. package/build/require/type/keyof/keyof-property-keys.d.ts +2 -0
  472. package/build/require/type/keyof/keyof-property-keys.js +47 -0
  473. package/build/require/type/keyof/keyof.d.ts +4 -2
  474. package/build/require/type/keyof/keyof.js +34 -1
  475. package/build/require/type/literal/index.js +27 -0
  476. package/build/require/type/literal/literal.d.ts +1 -0
  477. package/build/require/type/literal/literal.js +28 -0
  478. package/build/require/type/mapped/index.js +27 -0
  479. package/build/require/type/mapped/mapped-key.js +28 -0
  480. package/build/require/type/mapped/mapped-result.js +28 -0
  481. package/build/require/type/mapped/mapped.d.ts +2 -0
  482. package/build/require/type/mapped/mapped.js +63 -19
  483. package/build/require/type/modifiers/index.js +27 -0
  484. package/build/require/type/modifiers/modifiers.js +37 -0
  485. package/build/require/type/never/index.js +27 -0
  486. package/build/require/type/never/never.d.ts +1 -0
  487. package/build/require/type/never/never.js +28 -0
  488. package/build/require/type/not/index.js +27 -0
  489. package/build/require/type/not/not.d.ts +1 -0
  490. package/build/require/type/not/not.js +28 -0
  491. package/build/require/type/null/index.js +27 -0
  492. package/build/require/type/null/null.d.ts +1 -0
  493. package/build/require/type/null/null.js +28 -0
  494. package/build/require/type/number/index.js +27 -0
  495. package/build/require/type/number/number.d.ts +1 -0
  496. package/build/require/type/number/number.js +28 -0
  497. package/build/require/type/object/index.js +27 -0
  498. package/build/require/type/object/object.d.ts +10 -5
  499. package/build/require/type/object/object.js +33 -0
  500. package/build/require/type/omit/index.js +27 -0
  501. package/build/require/type/omit/omit-from-mapped-key.js +31 -0
  502. package/build/require/type/omit/omit.d.ts +3 -0
  503. package/build/require/type/omit/omit.js +39 -0
  504. package/build/require/type/operators/index.js +27 -0
  505. package/build/require/type/operators/operators.d.ts +8 -0
  506. package/build/require/type/operators/operators.js +42 -0
  507. package/build/require/type/optional/index.js +27 -0
  508. package/build/require/type/optional/optional.d.ts +1 -0
  509. package/build/require/type/optional/optional.js +28 -0
  510. package/build/require/type/parameters/index.js +27 -0
  511. package/build/require/type/parameters/parameters.d.ts +1 -0
  512. package/build/require/type/parameters/parameters.js +28 -0
  513. package/build/require/type/partial/index.js +27 -0
  514. package/build/require/type/partial/partial-from-mapped-result.js +30 -0
  515. package/build/require/type/partial/partial.d.ts +2 -0
  516. package/build/require/type/partial/partial.js +36 -0
  517. package/build/require/type/patterns/index.js +27 -0
  518. package/build/require/type/patterns/patterns.js +27 -0
  519. package/build/require/type/pick/index.js +27 -0
  520. package/build/require/type/pick/pick-from-mapped-key.js +31 -0
  521. package/build/require/type/pick/pick.d.ts +3 -0
  522. package/build/require/type/pick/pick.js +34 -0
  523. package/build/require/type/promise/index.js +27 -0
  524. package/build/require/type/promise/promise.d.ts +1 -0
  525. package/build/require/type/promise/promise.js +28 -0
  526. package/build/require/type/readonly/index.js +27 -0
  527. package/build/require/type/readonly/readonly.d.ts +1 -0
  528. package/build/require/type/readonly/readonly.js +28 -0
  529. package/build/require/type/readonly-optional/index.js +27 -0
  530. package/build/require/type/readonly-optional/readonly-optional.d.ts +1 -0
  531. package/build/require/type/readonly-optional/readonly-optional.js +28 -0
  532. package/build/require/type/record/index.js +27 -0
  533. package/build/require/type/record/record.d.ts +1 -1
  534. package/build/require/type/record/record.js +49 -2
  535. package/build/require/type/recursive/index.js +27 -0
  536. package/build/require/type/recursive/recursive.d.ts +4 -2
  537. package/build/require/type/recursive/recursive.js +31 -5
  538. package/build/require/type/ref/index.js +27 -0
  539. package/build/require/type/ref/ref.d.ts +2 -0
  540. package/build/require/type/ref/ref.js +28 -0
  541. package/build/require/type/regexp/index.js +27 -0
  542. package/build/require/type/regexp/regexp.d.ts +2 -0
  543. package/build/require/type/regexp/regexp.js +28 -0
  544. package/build/require/type/registry/format.d.ts +6 -0
  545. package/build/require/type/registry/format.js +34 -0
  546. package/build/require/type/registry/index.js +27 -0
  547. package/build/require/type/registry/type.d.ts +6 -0
  548. package/build/require/type/registry/type.js +34 -0
  549. package/build/require/type/required/index.js +27 -0
  550. package/build/require/type/required/required-from-mapped-result.js +30 -0
  551. package/build/require/type/required/required.d.ts +2 -0
  552. package/build/require/type/required/required.js +36 -0
  553. package/build/require/type/rest/index.js +27 -0
  554. package/build/require/type/rest/rest.d.ts +1 -0
  555. package/build/require/type/rest/rest.js +32 -0
  556. package/build/require/type/return-type/index.js +27 -0
  557. package/build/require/type/return-type/return-type.d.ts +1 -0
  558. package/build/require/type/return-type/return-type.js +28 -0
  559. package/build/require/type/schema/anyschema.js +27 -0
  560. package/build/require/type/schema/index.js +27 -0
  561. package/build/require/type/schema/schema.d.ts +7 -0
  562. package/build/require/type/schema/schema.js +27 -0
  563. package/build/require/type/static/index.js +27 -0
  564. package/build/require/type/static/static.d.ts +3 -0
  565. package/build/require/type/static/static.js +27 -0
  566. package/build/require/type/strict/index.js +27 -0
  567. package/build/require/type/strict/strict.d.ts +1 -0
  568. package/build/require/type/strict/strict.js +28 -0
  569. package/build/require/type/string/index.js +27 -0
  570. package/build/require/type/string/string.d.ts +7 -0
  571. package/build/require/type/string/string.js +28 -0
  572. package/build/require/type/symbol/index.js +27 -0
  573. package/build/require/type/symbol/symbol.d.ts +1 -0
  574. package/build/require/type/symbol/symbol.js +28 -0
  575. package/build/require/type/symbols/index.js +27 -0
  576. package/build/require/type/symbols/symbols.d.ts +5 -0
  577. package/build/require/type/symbols/symbols.js +32 -0
  578. package/build/require/type/template-literal/finite.js +37 -0
  579. package/build/require/type/template-literal/generate.js +37 -0
  580. package/build/require/type/template-literal/index.js +27 -0
  581. package/build/require/type/template-literal/parser.d.ts +2 -0
  582. package/build/require/type/template-literal/parser.js +44 -0
  583. package/build/require/type/template-literal/pattern.js +38 -0
  584. package/build/require/type/template-literal/syntax.d.ts +5 -4
  585. package/build/require/type/template-literal/syntax.js +35 -0
  586. package/build/require/type/template-literal/template-literal.d.ts +6 -4
  587. package/build/require/type/template-literal/template-literal.js +29 -0
  588. package/build/require/type/template-literal/union.d.ts +1 -0
  589. package/build/require/type/template-literal/union.js +31 -0
  590. package/build/require/type/transform/index.js +27 -0
  591. package/build/require/type/transform/transform.d.ts +4 -2
  592. package/build/require/type/transform/transform.js +40 -4
  593. package/build/require/type/tuple/index.js +27 -0
  594. package/build/require/type/tuple/tuple.d.ts +4 -3
  595. package/build/require/type/tuple/tuple.js +30 -0
  596. package/build/require/type/type/index.d.ts +1 -0
  597. package/build/require/type/type/index.js +34 -0
  598. package/build/require/type/type/javascript.d.ts +19 -0
  599. package/build/require/type/type/javascript.js +45 -0
  600. package/build/require/type/type/json.d.ts +66 -5
  601. package/build/require/type/type/json.js +82 -1
  602. package/build/require/type/type/type.js +30 -0
  603. package/build/require/type/uint8array/index.js +27 -0
  604. package/build/require/type/uint8array/uint8array.d.ts +1 -0
  605. package/build/require/type/uint8array/uint8array.js +28 -0
  606. package/build/require/type/undefined/index.js +27 -0
  607. package/build/require/type/undefined/undefined.d.ts +1 -0
  608. package/build/require/type/undefined/undefined.js +28 -0
  609. package/build/require/type/union/index.d.ts +2 -0
  610. package/build/require/type/union/index.js +29 -0
  611. package/build/require/type/union/union-create.d.ts +3 -0
  612. package/build/require/type/union/union-create.js +36 -0
  613. package/build/require/type/union/union-evaluated.d.ts +17 -0
  614. package/build/require/type/union/union-evaluated.js +72 -0
  615. package/build/require/type/union/union-type.d.ts +12 -0
  616. package/build/require/type/union/union-type.js +30 -0
  617. package/build/require/type/union/union.d.ts +4 -13
  618. package/build/require/type/union/union.js +32 -11
  619. package/build/require/type/unknown/index.js +27 -0
  620. package/build/require/type/unknown/unknown.d.ts +1 -0
  621. package/build/require/type/unknown/unknown.js +28 -0
  622. package/build/require/type/unsafe/index.js +27 -0
  623. package/build/require/type/unsafe/unsafe.d.ts +1 -0
  624. package/build/require/type/unsafe/unsafe.js +28 -0
  625. package/build/require/type/void/index.js +27 -0
  626. package/build/require/type/void/void.d.ts +1 -0
  627. package/build/require/type/void/void.js +28 -0
  628. package/build/require/value/cast/cast.d.ts +2 -0
  629. package/build/require/value/cast/cast.js +55 -0
  630. package/build/require/value/cast/index.js +27 -0
  631. package/build/require/value/check/check.d.ts +2 -0
  632. package/build/require/value/check/check.js +46 -1
  633. package/build/require/value/check/index.js +27 -0
  634. package/build/require/value/clean/clean.d.ts +2 -0
  635. package/build/require/value/clean/clean.js +39 -1
  636. package/build/require/value/clean/index.js +27 -0
  637. package/build/require/value/clone/clone.d.ts +1 -0
  638. package/build/require/value/clone/clone.js +34 -0
  639. package/build/require/value/clone/index.js +27 -0
  640. package/build/require/value/convert/convert.d.ts +2 -0
  641. package/build/require/value/convert/convert.js +57 -1
  642. package/build/require/value/convert/index.js +27 -0
  643. package/build/require/value/create/create.d.ts +2 -0
  644. package/build/require/value/create/create.js +44 -0
  645. package/build/require/value/create/index.js +27 -0
  646. package/build/require/value/default/default.d.ts +2 -0
  647. package/build/require/value/default/default.js +46 -0
  648. package/build/require/value/default/index.js +27 -0
  649. package/build/require/value/delta/delta.d.ts +1 -1
  650. package/build/require/value/delta/delta.js +42 -0
  651. package/build/require/value/delta/index.js +27 -0
  652. package/build/require/value/deref/deref.d.ts +1 -0
  653. package/build/require/value/deref/deref.js +28 -0
  654. package/build/require/value/deref/index.js +27 -0
  655. package/build/require/value/equal/equal.d.ts +1 -0
  656. package/build/require/value/equal/equal.js +34 -0
  657. package/build/require/value/equal/index.js +27 -0
  658. package/build/require/value/guard/guard.d.ts +20 -0
  659. package/build/require/value/guard/guard.js +57 -0
  660. package/build/require/value/guard/index.js +27 -0
  661. package/build/require/value/hash/hash.d.ts +1 -0
  662. package/build/require/value/hash/hash.js +46 -0
  663. package/build/require/value/hash/index.js +27 -0
  664. package/build/require/value/index.js +39 -0
  665. package/build/require/value/mutate/index.js +27 -0
  666. package/build/require/value/mutate/mutate.d.ts +1 -0
  667. package/build/require/value/mutate/mutate.js +38 -0
  668. package/build/require/value/pointer/index.js +27 -0
  669. package/build/require/value/pointer/pointer.d.ts +5 -0
  670. package/build/require/value/pointer/pointer.js +45 -0
  671. package/build/require/value/transform/decode.d.ts +5 -0
  672. package/build/require/value/transform/decode.js +50 -0
  673. package/build/require/value/transform/encode.d.ts +6 -0
  674. package/build/require/value/transform/encode.js +52 -0
  675. package/build/require/value/transform/has.d.ts +1 -0
  676. package/build/require/value/transform/has.js +43 -0
  677. package/build/require/value/transform/index.js +27 -0
  678. package/build/require/value/value/index.js +27 -0
  679. package/build/require/value/value/value.d.ts +24 -0
  680. package/build/require/value/value/value.js +42 -0
  681. package/package.json +1 -1
  682. package/readme.md +27 -20
@@ -1,31 +1,72 @@
1
+ /*--------------------------------------------------------------------------
2
+
3
+ @sinclair/typebox/type
4
+
5
+ The MIT License (MIT)
6
+
7
+ Copyright (c) 2017-2023 Haydn Paterson (sinclair) <haydn.developer@gmail.com>
8
+
9
+ Permission is hereby granted, free of charge, to any person obtaining a copy
10
+ of this software and associated documentation files (the "Software"), to deal
11
+ in the Software without restriction, including without limitation the rights
12
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
+ copies of the Software, and to permit persons to whom the Software is
14
+ furnished to do so, subject to the following conditions:
15
+
16
+ The above copyright notice and this permission notice shall be included in
17
+ all copies or substantial portions of the Software.
18
+
19
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25
+ THE SOFTWARE.
26
+
27
+ ---------------------------------------------------------------------------*/
1
28
  import { Increment } from '../helpers/index.mjs';
2
29
  import { OperatorUnionMany, OperatorIntersectMany } from '../operators/index.mjs';
30
+ // ------------------------------------------------------------------
31
+ // TypeGuard
32
+ // ------------------------------------------------------------------
33
+ // prettier-ignore
3
34
  import { TIntersect as IsIntersectType, TUnion as IsUnionType, TTuple as IsTupleType, TArray as IsArrayType, TObject as IsObjectType, TRecord as IsRecordType } from '../guard/type.mjs';
35
+ // prettier-ignore
4
36
  function FromRest(T) {
5
37
  const [L, ...R] = T;
6
38
  return (T.length > 0
7
39
  ? [KeyOfPropertyKeys(L), ...FromRest(R)]
8
40
  : []);
9
41
  }
42
+ // prettier-ignore
10
43
  function FromIntersect(T, C = FromRest(T)) {
11
44
  return OperatorUnionMany(C);
12
45
  }
46
+ // prettier-ignore
13
47
  function FromUnion(T) {
14
48
  const C = FromRest(T);
15
49
  return OperatorIntersectMany(C);
16
50
  }
51
+ // prettier-ignore
17
52
  function FromTuple(T, I = '0') {
18
53
  const [_, ...R] = T;
19
54
  return (T.length > 0
20
55
  ? [I, ...FromTuple(R, Increment(I))]
21
56
  : []);
22
57
  }
58
+ // prettier-ignore
23
59
  function FromArray(_) {
24
60
  return (['[number]']);
25
61
  }
62
+ // prettier-ignore
26
63
  function FromProperties(T) {
27
64
  return (globalThis.Object.getOwnPropertyNames(T));
28
65
  }
66
+ // ------------------------------------------------------------------
67
+ // FromPatternProperties
68
+ // ------------------------------------------------------------------
69
+ // prettier-ignore
29
70
  function FromPatternProperties(patternProperties) {
30
71
  if (!includePatternProperties)
31
72
  return [];
@@ -36,6 +77,8 @@ function FromPatternProperties(patternProperties) {
36
77
  : key;
37
78
  });
38
79
  }
80
+ /** Returns a tuple of PropertyKeys derived from the given TSchema. */
81
+ // prettier-ignore
39
82
  export function KeyOfPropertyKeys(T) {
40
83
  return (IsIntersectType(T) ? FromIntersect(T.allOf) :
41
84
  IsUnionType(T) ? FromUnion(T.anyOf) :
@@ -45,7 +88,11 @@ export function KeyOfPropertyKeys(T) {
45
88
  IsRecordType(T) ? FromPatternProperties(T.patternProperties) :
46
89
  []);
47
90
  }
91
+ // ----------------------------------------------------------------
92
+ // KeyOfPattern
93
+ // ----------------------------------------------------------------
48
94
  let includePatternProperties = false;
95
+ /** Returns a regular expression pattern derived from the given TSchema */
49
96
  export function KeyOfPattern(schema) {
50
97
  includePatternProperties = true;
51
98
  const keys = KeyOfPropertyKeys(schema);
@@ -5,11 +5,13 @@ import { type TLiteral, TLiteralValue } from '../literal/index.mjs';
5
5
  import { type TNumber } from '../number/index.mjs';
6
6
  import { type SchemaOptions } from '../schema/index.mjs';
7
7
  import { KeyOfPropertyKeys } from './keyof-property-keys.mjs';
8
- import { UnionResolve } from '../union/index.mjs';
8
+ import { UnionEvaluated } from '../union/index.mjs';
9
9
  import { type TKeyOfFromMappedResult } from './keyof-from-mapped-result.mjs';
10
10
  type FromLiterals<T extends TLiteralValue[]> = (T extends [infer L extends TLiteralValue, ...infer R extends TLiteralValue[]] ? L extends '[number]' ? [TNumber, ...FromLiterals<R>] : [TLiteral<L>, ...FromLiterals<R>] : []);
11
11
  declare function FromLiterals<T extends TLiteralValue[]>(T: [...T]): FromLiterals<T>;
12
- export type TKeyOf<T extends TSchema> = (Ensure<UnionResolve<FromLiterals<KeyOfPropertyKeys<T>>>>);
12
+ export type TKeyOf<T extends TSchema> = (Ensure<UnionEvaluated<FromLiterals<KeyOfPropertyKeys<T>>>>);
13
+ /** `[Json]` Creates a KeyOf type */
13
14
  export declare function KeyOf<T extends TMappedResult>(T: T, options?: SchemaOptions): TKeyOfFromMappedResult<T>;
15
+ /** `[Json]` Creates a KeyOf type */
14
16
  export declare function KeyOf<T extends TSchema>(T: T, options?: SchemaOptions): TKeyOf<T>;
15
17
  export {};
@@ -1,10 +1,42 @@
1
+ /*--------------------------------------------------------------------------
2
+
3
+ @sinclair/typebox/type
4
+
5
+ The MIT License (MIT)
6
+
7
+ Copyright (c) 2017-2023 Haydn Paterson (sinclair) <haydn.developer@gmail.com>
8
+
9
+ Permission is hereby granted, free of charge, to any person obtaining a copy
10
+ of this software and associated documentation files (the "Software"), to deal
11
+ in the Software without restriction, including without limitation the rights
12
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
+ copies of the Software, and to permit persons to whom the Software is
14
+ furnished to do so, subject to the following conditions:
15
+
16
+ The above copyright notice and this permission notice shall be included in
17
+ all copies or substantial portions of the Software.
18
+
19
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25
+ THE SOFTWARE.
26
+
27
+ ---------------------------------------------------------------------------*/
1
28
  import { Literal } from '../literal/index.mjs';
2
29
  import { Number } from '../number/index.mjs';
3
30
  import { KeyOfPropertyKeys } from './keyof-property-keys.mjs';
4
- import { UnionResolve } from '../union/index.mjs';
31
+ import { UnionEvaluated } from '../union/index.mjs';
5
32
  import { CloneType } from '../clone/type.mjs';
6
33
  import { KeyOfFromMappedResult } from './keyof-from-mapped-result.mjs';
34
+ // ------------------------------------------------------------------
35
+ // TypeGuard
36
+ // ------------------------------------------------------------------
37
+ // prettier-ignore
7
38
  import { TMappedResult as IsMappedResultType } from '../guard/type.mjs';
39
+ // prettier-ignore
8
40
  function FromLiterals(T) {
9
41
  const [L, ...R] = T;
10
42
  return (T.length > 0
@@ -13,12 +45,13 @@ function FromLiterals(T) {
13
45
  : [Literal(L), ...FromLiterals(R)]
14
46
  : []);
15
47
  }
48
+ /** `[Json]` Creates a KeyOf type */
16
49
  export function KeyOf(T, options = {}) {
17
50
  if (IsMappedResultType(T)) {
18
51
  return KeyOfFromMappedResult(T, options);
19
52
  }
20
53
  else {
21
- const K = UnionResolve(FromLiterals(KeyOfPropertyKeys(T)));
54
+ const K = UnionEvaluated(FromLiterals(KeyOfPropertyKeys(T)));
22
55
  return CloneType(K, options);
23
56
  }
24
57
  }
@@ -1 +1,28 @@
1
+ /*--------------------------------------------------------------------------
2
+
3
+ @sinclair/typebox/type
4
+
5
+ The MIT License (MIT)
6
+
7
+ Copyright (c) 2017-2023 Haydn Paterson (sinclair) <haydn.developer@gmail.com>
8
+
9
+ Permission is hereby granted, free of charge, to any person obtaining a copy
10
+ of this software and associated documentation files (the "Software"), to deal
11
+ in the Software without restriction, including without limitation the rights
12
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
+ copies of the Software, and to permit persons to whom the Software is
14
+ furnished to do so, subject to the following conditions:
15
+
16
+ The above copyright notice and this permission notice shall be included in
17
+ all copies or substantial portions of the Software.
18
+
19
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25
+ THE SOFTWARE.
26
+
27
+ ---------------------------------------------------------------------------*/
1
28
  export * from './literal.mjs';
@@ -6,4 +6,5 @@ export interface TLiteral<T extends TLiteralValue = TLiteralValue> extends TSche
6
6
  static: T;
7
7
  const: T;
8
8
  }
9
+ /** `[Json]` Creates a Literal type */
9
10
  export declare function Literal<T extends TLiteralValue>(value: T, options?: SchemaOptions): TLiteral<T>;
@@ -1,4 +1,32 @@
1
+ /*--------------------------------------------------------------------------
2
+
3
+ @sinclair/typebox/type
4
+
5
+ The MIT License (MIT)
6
+
7
+ Copyright (c) 2017-2023 Haydn Paterson (sinclair) <haydn.developer@gmail.com>
8
+
9
+ Permission is hereby granted, free of charge, to any person obtaining a copy
10
+ of this software and associated documentation files (the "Software"), to deal
11
+ in the Software without restriction, including without limitation the rights
12
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
+ copies of the Software, and to permit persons to whom the Software is
14
+ furnished to do so, subject to the following conditions:
15
+
16
+ The above copyright notice and this permission notice shall be included in
17
+ all copies or substantial portions of the Software.
18
+
19
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25
+ THE SOFTWARE.
26
+
27
+ ---------------------------------------------------------------------------*/
1
28
  import { Kind } from '../symbols/index.mjs';
29
+ /** `[Json]` Creates a Literal type */
2
30
  export function Literal(value, options = {}) {
3
31
  return {
4
32
  ...options,
@@ -1,3 +1,30 @@
1
+ /*--------------------------------------------------------------------------
2
+
3
+ @sinclair/typebox/type
4
+
5
+ The MIT License (MIT)
6
+
7
+ Copyright (c) 2017-2023 Haydn Paterson (sinclair) <haydn.developer@gmail.com>
8
+
9
+ Permission is hereby granted, free of charge, to any person obtaining a copy
10
+ of this software and associated documentation files (the "Software"), to deal
11
+ in the Software without restriction, including without limitation the rights
12
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
+ copies of the Software, and to permit persons to whom the Software is
14
+ furnished to do so, subject to the following conditions:
15
+
16
+ The above copyright notice and this permission notice shall be included in
17
+ all copies or substantial portions of the Software.
18
+
19
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25
+ THE SOFTWARE.
26
+
27
+ ---------------------------------------------------------------------------*/
1
28
  export * from './mapped-key.mjs';
2
29
  export * from './mapped-result.mjs';
3
30
  export * from './mapped.mjs';
@@ -1,4 +1,32 @@
1
+ /*--------------------------------------------------------------------------
2
+
3
+ @sinclair/typebox/type
4
+
5
+ The MIT License (MIT)
6
+
7
+ Copyright (c) 2017-2023 Haydn Paterson (sinclair) <haydn.developer@gmail.com>
8
+
9
+ Permission is hereby granted, free of charge, to any person obtaining a copy
10
+ of this software and associated documentation files (the "Software"), to deal
11
+ in the Software without restriction, including without limitation the rights
12
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
+ copies of the Software, and to permit persons to whom the Software is
14
+ furnished to do so, subject to the following conditions:
15
+
16
+ The above copyright notice and this permission notice shall be included in
17
+ all copies or substantial portions of the Software.
18
+
19
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25
+ THE SOFTWARE.
26
+
27
+ ---------------------------------------------------------------------------*/
1
28
  import { Kind } from '../symbols/index.mjs';
29
+ // prettier-ignore
2
30
  export function MappedKey(T) {
3
31
  return {
4
32
  [Kind]: 'MappedKey',
@@ -1,4 +1,32 @@
1
+ /*--------------------------------------------------------------------------
2
+
3
+ @sinclair/typebox/type
4
+
5
+ The MIT License (MIT)
6
+
7
+ Copyright (c) 2017-2023 Haydn Paterson (sinclair) <haydn.developer@gmail.com>
8
+
9
+ Permission is hereby granted, free of charge, to any person obtaining a copy
10
+ of this software and associated documentation files (the "Software"), to deal
11
+ in the Software without restriction, including without limitation the rights
12
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
+ copies of the Software, and to permit persons to whom the Software is
14
+ furnished to do so, subject to the following conditions:
15
+
16
+ The above copyright notice and this permission notice shall be included in
17
+ all copies or substantial portions of the Software.
18
+
19
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25
+ THE SOFTWARE.
26
+
27
+ ---------------------------------------------------------------------------*/
1
28
  import { Kind } from '../symbols/index.mjs';
29
+ // prettier-ignore
2
30
  export function MappedResult(properties) {
3
31
  return {
4
32
  [Kind]: 'MappedResult',
@@ -38,6 +38,8 @@ type FromMappedFunctionReturnType<K extends PropertyKey[], T extends TSchema> =
38
38
  declare function FromMappedFunctionReturnType<K extends PropertyKey[], T extends TSchema>(K: [...K], T: T): FromMappedFunctionReturnType<K, T>;
39
39
  export type TMappedFunction<K extends PropertyKey[], I = TMappedKey<K>> = (T: I) => TSchema;
40
40
  export type TMapped<K extends PropertyKey[], F extends TMappedFunction<K>, R extends TProperties = Evaluate<FromMappedFunctionReturnType<K, ReturnType<F>>>> = Ensure<TObject<R>>;
41
+ /** `[Json]` Creates a Mapped object type */
41
42
  export declare function Mapped<K extends TSchema, I extends PropertyKey[] = TIndexPropertyKeys<K>, F extends TMappedFunction<I> = TMappedFunction<I>, R extends TMapped<I, F> = TMapped<I, F>>(key: K, map: F, options?: ObjectOptions): R;
43
+ /** `[Json]` Creates a Mapped object type */
42
44
  export declare function Mapped<K extends PropertyKey[], F extends TMappedFunction<K> = TMappedFunction<K>, R extends TMapped<K, F> = TMapped<K, F>>(key: [...K], map: F, options?: ObjectOptions): R;
43
45
  export {};
@@ -1,7 +1,34 @@
1
- import { TSchema as IsSchemaType } from '../guard/type.mjs';
1
+ /*--------------------------------------------------------------------------
2
+
3
+ @sinclair/typebox/type
4
+
5
+ The MIT License (MIT)
6
+
7
+ Copyright (c) 2017-2023 Haydn Paterson (sinclair) <haydn.developer@gmail.com>
8
+
9
+ Permission is hereby granted, free of charge, to any person obtaining a copy
10
+ of this software and associated documentation files (the "Software"), to deal
11
+ in the Software without restriction, including without limitation the rights
12
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
+ copies of the Software, and to permit persons to whom the Software is
14
+ furnished to do so, subject to the following conditions:
15
+
16
+ The above copyright notice and this permission notice shall be included in
17
+ all copies or substantial portions of the Software.
18
+
19
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25
+ THE SOFTWARE.
26
+
27
+ ---------------------------------------------------------------------------*/
2
28
  import { Kind, OptionalKind, ReadonlyKind } from '../symbols/index.mjs';
3
29
  import { CloneType } from '../clone/type.mjs';
4
30
  import { Discard } from '../discard/index.mjs';
31
+ // evaluation types
5
32
  import { Array } from '../array/index.mjs';
6
33
  import { AsyncIterator } from '../async-iterator/index.mjs';
7
34
  import { Constructor } from '../constructor/index.mjs';
@@ -16,39 +43,54 @@ import { Promise } from '../promise/index.mjs';
16
43
  import { Readonly } from '../readonly/index.mjs';
17
44
  import { Tuple } from '../tuple/index.mjs';
18
45
  import { Union } from '../union/index.mjs';
46
+ // mapping types
19
47
  import { MappedResult } from './mapped-result.mjs';
20
- import { TArray as IsArrayType, TAsyncIterator as IsAsyncIteratorType, TConstructor as IsConstructorType, TFunction as IsFunctionType, TIntersect as IsIntersectType, TIterator as IsIteratorType, TReadonly as IsReadonlyType, TMappedResult as IsMappedResultType, TMappedKey as IsMappedKeyType, TObject as IsObjectType, TOptional as IsOptionalType, TPromise as IsPromiseType, TTuple as IsTupleType, TUnion as IsUnionType, } from '../guard/type.mjs';
48
+ // ------------------------------------------------------------------
49
+ // TypeGuard
50
+ // ------------------------------------------------------------------
51
+ // prettier-ignore
52
+ import { TArray as IsArrayType, TAsyncIterator as IsAsyncIteratorType, TConstructor as IsConstructorType, TFunction as IsFunctionType, TIntersect as IsIntersectType, TIterator as IsIteratorType, TReadonly as IsReadonlyType, TMappedResult as IsMappedResultType, TMappedKey as IsMappedKeyType, TObject as IsObjectType, TOptional as IsOptionalType, TPromise as IsPromiseType, TSchema as IsSchemaType, TTuple as IsTupleType, TUnion as IsUnionType, } from '../guard/type.mjs';
53
+ // prettier-ignore
21
54
  function FromMappedResult(K, P) {
22
55
  return (K in P
23
56
  ? FromSchemaType(K, P[K])
24
57
  : MappedResult(P));
25
58
  }
59
+ // prettier-ignore
26
60
  function MappedKeyToMappedResultProperties(K, P) {
27
61
  const [L, ...R] = P;
28
62
  return (P.length > 0
29
63
  ? { [L]: Literal(L), ...MappedKeyToMappedResultProperties(K, R) }
30
64
  : {});
31
65
  }
66
+ // prettier-ignore
32
67
  function FromMappedKey(K, P) {
33
68
  const R = MappedKeyToMappedResultProperties(K, P);
34
69
  return FromMappedResult(K, R);
35
70
  }
71
+ // prettier-ignore
36
72
  function FromRest(K, T) {
37
73
  const [L, ...R] = T;
38
74
  return (T.length > 0
39
75
  ? [FromSchemaType(K, L), ...FromRest(K, R)]
40
76
  : []);
41
77
  }
78
+ // prettier-ignore
42
79
  function FromProperties(K, T) {
43
80
  return globalThis.Object.getOwnPropertyNames(T).reduce((Acc, K2) => {
44
81
  return { ...Acc, [K2]: FromSchemaType(K, T[K2]) };
45
82
  }, {});
46
83
  }
84
+ // prettier-ignore
47
85
  function FromSchemaType(K, T) {
48
- return (IsOptionalType(T) ? Optional(FromSchemaType(K, Discard(T, [OptionalKind]))) :
86
+ return (
87
+ // unevaluated modifier types
88
+ IsOptionalType(T) ? Optional(FromSchemaType(K, Discard(T, [OptionalKind]))) :
49
89
  IsReadonlyType(T) ? Readonly(FromSchemaType(K, Discard(T, [ReadonlyKind]))) :
90
+ // unevaluated mapped types
50
91
  IsMappedResultType(T) ? FromMappedResult(K, T.properties) :
51
92
  IsMappedKeyType(T) ? FromMappedKey(K, T.keys) :
93
+ // unevaluated types
52
94
  IsConstructorType(T) ? Constructor(FromRest(K, T.parameters), FromSchemaType(K, T.returns)) :
53
95
  IsFunctionType(T) ? FunctionType(FromRest(K, T.parameters), FromSchemaType(K, T.returns)) :
54
96
  IsAsyncIteratorType(T) ? AsyncIterator(FromSchemaType(K, T.items)) :
@@ -61,12 +103,14 @@ function FromSchemaType(K, T) {
61
103
  IsPromiseType(T) ? Promise(FromSchemaType(K, T.item)) :
62
104
  T);
63
105
  }
106
+ // prettier-ignore
64
107
  function FromMappedFunctionReturnType(K, T) {
65
108
  const [L, ...R] = K;
66
109
  return (K.length > 0
67
110
  ? { [L]: FromSchemaType(L, T), ...FromMappedFunctionReturnType(R, T) }
68
111
  : {});
69
112
  }
113
+ /** `[Json]` Creates a Mapped object type */
70
114
  export function Mapped(key, map, options = {}) {
71
115
  const K = IsSchemaType(key) ? IndexPropertyKeys(key) : key;
72
116
  const RT = map({ [Kind]: 'MappedKey', keys: K });
@@ -1 +1,28 @@
1
+ /*--------------------------------------------------------------------------
2
+
3
+ @sinclair/typebox/type
4
+
5
+ The MIT License (MIT)
6
+
7
+ Copyright (c) 2017-2023 Haydn Paterson (sinclair) <haydn.developer@gmail.com>
8
+
9
+ Permission is hereby granted, free of charge, to any person obtaining a copy
10
+ of this software and associated documentation files (the "Software"), to deal
11
+ in the Software without restriction, including without limitation the rights
12
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
+ copies of the Software, and to permit persons to whom the Software is
14
+ furnished to do so, subject to the following conditions:
15
+
16
+ The above copyright notice and this permission notice shall be included in
17
+ all copies or substantial portions of the Software.
18
+
19
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25
+ THE SOFTWARE.
26
+
27
+ ---------------------------------------------------------------------------*/
1
28
  export * from './modifiers.mjs';
@@ -1,9 +1,41 @@
1
+ /*--------------------------------------------------------------------------
2
+
3
+ @sinclair/typebox/type
4
+
5
+ The MIT License (MIT)
6
+
7
+ Copyright (c) 2017-2023 Haydn Paterson (sinclair) <haydn.developer@gmail.com>
8
+
9
+ Permission is hereby granted, free of charge, to any person obtaining a copy
10
+ of this software and associated documentation files (the "Software"), to deal
11
+ in the Software without restriction, including without limitation the rights
12
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
+ copies of the Software, and to permit persons to whom the Software is
14
+ furnished to do so, subject to the following conditions:
15
+
16
+ The above copyright notice and this permission notice shall be included in
17
+ all copies or substantial portions of the Software.
18
+
19
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25
+ THE SOFTWARE.
26
+
27
+ ---------------------------------------------------------------------------*/
1
28
  import { Intersect } from '../intersect/index.mjs';
2
29
  import { Union } from '../union/index.mjs';
3
30
  import { Optional } from '../optional/index.mjs';
4
31
  import { Discard } from '../discard/index.mjs';
5
32
  import { OptionalKind } from '../symbols/index.mjs';
33
+ // ------------------------------------------------------------------
34
+ // TypeGuard
35
+ // ------------------------------------------------------------------
36
+ // prettier-ignore
6
37
  import { TOptional as IsOptionalType } from '../guard/type.mjs';
38
+ // prettier-ignore
7
39
  function IsOptionalFromIntersect(T) {
8
40
  const [L, ...R] = T;
9
41
  return (T.length > 0
@@ -12,6 +44,7 @@ function IsOptionalFromIntersect(T) {
12
44
  : false
13
45
  : true);
14
46
  }
47
+ // prettier-ignore
15
48
  function IsOptionalFromUnion(T) {
16
49
  const [L, ...R] = T;
17
50
  return (T.length > 0
@@ -20,18 +53,22 @@ function IsOptionalFromUnion(T) {
20
53
  : IsOptionalFromUnion(R)
21
54
  : false);
22
55
  }
56
+ // prettier-ignore
23
57
  function RemoveOptionalFromRest(T) {
24
58
  return (T.map(T => RemoveOptionalFromSchema(T)));
25
59
  }
60
+ // prettier-ignore
26
61
  function RemoveOptionalFromSchema(T) {
27
62
  return (Discard(T, [OptionalKind]));
28
63
  }
64
+ // prettier-ignore
29
65
  export function OptionalFromIntersect(T) {
30
66
  const D = RemoveOptionalFromRest(T);
31
67
  return (IsOptionalFromIntersect(T)
32
68
  ? Optional(Intersect(D))
33
69
  : Intersect(T));
34
70
  }
71
+ // prettier-ignore
35
72
  export function OptionalFromUnion(T) {
36
73
  const D = RemoveOptionalFromRest(T);
37
74
  return (IsOptionalFromUnion(T)
@@ -1 +1,28 @@
1
+ /*--------------------------------------------------------------------------
2
+
3
+ @sinclair/typebox/type
4
+
5
+ The MIT License (MIT)
6
+
7
+ Copyright (c) 2017-2023 Haydn Paterson (sinclair) <haydn.developer@gmail.com>
8
+
9
+ Permission is hereby granted, free of charge, to any person obtaining a copy
10
+ of this software and associated documentation files (the "Software"), to deal
11
+ in the Software without restriction, including without limitation the rights
12
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
+ copies of the Software, and to permit persons to whom the Software is
14
+ furnished to do so, subject to the following conditions:
15
+
16
+ The above copyright notice and this permission notice shall be included in
17
+ all copies or substantial portions of the Software.
18
+
19
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25
+ THE SOFTWARE.
26
+
27
+ ---------------------------------------------------------------------------*/
1
28
  export * from './never.mjs';
@@ -5,4 +5,5 @@ export interface TNever extends TSchema {
5
5
  static: never;
6
6
  not: {};
7
7
  }
8
+ /** `[Json]` Creates a Never type */
8
9
  export declare function Never(options?: SchemaOptions): TNever;
@@ -1,4 +1,32 @@
1
+ /*--------------------------------------------------------------------------
2
+
3
+ @sinclair/typebox/type
4
+
5
+ The MIT License (MIT)
6
+
7
+ Copyright (c) 2017-2023 Haydn Paterson (sinclair) <haydn.developer@gmail.com>
8
+
9
+ Permission is hereby granted, free of charge, to any person obtaining a copy
10
+ of this software and associated documentation files (the "Software"), to deal
11
+ in the Software without restriction, including without limitation the rights
12
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
+ copies of the Software, and to permit persons to whom the Software is
14
+ furnished to do so, subject to the following conditions:
15
+
16
+ The above copyright notice and this permission notice shall be included in
17
+ all copies or substantial portions of the Software.
18
+
19
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25
+ THE SOFTWARE.
26
+
27
+ ---------------------------------------------------------------------------*/
1
28
  import { Kind } from '../symbols/index.mjs';
29
+ /** `[Json]` Creates a Never type */
2
30
  export function Never(options = {}) {
3
31
  return {
4
32
  ...options,
@@ -1 +1,28 @@
1
+ /*--------------------------------------------------------------------------
2
+
3
+ @sinclair/typebox/type
4
+
5
+ The MIT License (MIT)
6
+
7
+ Copyright (c) 2017-2023 Haydn Paterson (sinclair) <haydn.developer@gmail.com>
8
+
9
+ Permission is hereby granted, free of charge, to any person obtaining a copy
10
+ of this software and associated documentation files (the "Software"), to deal
11
+ in the Software without restriction, including without limitation the rights
12
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
+ copies of the Software, and to permit persons to whom the Software is
14
+ furnished to do so, subject to the following conditions:
15
+
16
+ The above copyright notice and this permission notice shall be included in
17
+ all copies or substantial portions of the Software.
18
+
19
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25
+ THE SOFTWARE.
26
+
27
+ ---------------------------------------------------------------------------*/
1
28
  export * from './not.mjs';