arktype 2.0.0-dev.4 → 2.0.0-dev.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 (479) hide show
  1. package/__tests__/array.test.ts +176 -236
  2. package/__tests__/badDefinitionType.test.ts +10 -3
  3. package/__tests__/basis.test.ts +6 -2
  4. package/__tests__/bounds.test.ts +282 -352
  5. package/__tests__/cast.test.ts +7 -2
  6. package/__tests__/completions.test.ts +8 -3
  7. package/__tests__/config.test.ts +16 -8
  8. package/__tests__/cyclic.test.ts +141 -137
  9. package/__tests__/dateLiteral.test.ts +8 -4
  10. package/__tests__/declared.test.ts +2 -2
  11. package/__tests__/discrimination.test.ts +1 -1
  12. package/__tests__/divisor.test.ts +45 -25
  13. package/__tests__/enclosed.test.ts +39 -25
  14. package/__tests__/examples.test.ts +56 -56
  15. package/__tests__/expressions.test.ts +184 -112
  16. package/__tests__/generic.test.ts +307 -288
  17. package/__tests__/group.test.ts +67 -54
  18. package/__tests__/imports.test.ts +44 -37
  19. package/__tests__/instanceof.test.ts +17 -15
  20. package/__tests__/intersection.test.ts +50 -46
  21. package/__tests__/keyTraversal.test.ts +6 -3
  22. package/__tests__/keyof.test.ts +68 -52
  23. package/__tests__/keywords.test.ts +149 -136
  24. package/__tests__/literal.test.ts +38 -15
  25. package/__tests__/match.test.ts +234 -224
  26. package/__tests__/morph.test.ts +300 -269
  27. package/__tests__/narrow.test.ts +46 -42
  28. package/__tests__/objectLiteral.test.ts +228 -210
  29. package/__tests__/realWorld.test.ts +63 -0
  30. package/__tests__/regex.test.ts +17 -7
  31. package/__tests__/scope.bench.ts +1 -1
  32. package/__tests__/scope.test.ts +65 -18
  33. package/__tests__/serialization.test.ts +19 -0
  34. package/__tests__/string.test.ts +11 -7
  35. package/__tests__/submodule.test.ts +26 -39
  36. package/__tests__/this.test.ts +83 -57
  37. package/__tests__/thunk.test.ts +13 -7
  38. package/__tests__/traverse.test.ts +50 -37
  39. package/__tests__/tsGenerics.test.ts +12 -12
  40. package/__tests__/type.test.ts +38 -0
  41. package/__tests__/typeReference.test.ts +7 -7
  42. package/__tests__/unenclosed.test.ts +116 -100
  43. package/__tests__/union.test.ts +171 -104
  44. package/ark.ts +18 -65
  45. package/generic.ts +67 -0
  46. package/main.ts +6 -18
  47. package/match.ts +53 -67
  48. package/module.ts +15 -0
  49. package/out/ark.d.ts +12 -36
  50. package/out/ark.d.ts.map +1 -1
  51. package/out/ark.js +9 -17
  52. package/out/ark.js.map +1 -1
  53. package/out/base.d.ts +205 -0
  54. package/out/base.d.ts.map +1 -0
  55. package/out/base.js +320 -0
  56. package/out/base.js.map +1 -0
  57. package/out/builtins/builtins.d.ts +23 -0
  58. package/out/builtins/builtins.d.ts.map +1 -0
  59. package/out/builtins/builtins.js +15 -0
  60. package/out/builtins/builtins.js.map +1 -0
  61. package/out/builtins/jsObjects.d.ts +19 -0
  62. package/out/builtins/jsObjects.d.ts.map +1 -0
  63. package/out/builtins/jsObjects.js +18 -0
  64. package/out/builtins/jsObjects.js.map +1 -0
  65. package/out/builtins/parsing.d.ts +16 -0
  66. package/out/builtins/parsing.d.ts.map +1 -0
  67. package/out/builtins/parsing.js +62 -0
  68. package/out/builtins/parsing.js.map +1 -0
  69. package/out/builtins/tsGenerics.d.ts +2 -0
  70. package/out/builtins/tsGenerics.d.ts.map +1 -0
  71. package/out/builtins/tsGenerics.js +26 -0
  72. package/out/builtins/tsGenerics.js.map +1 -0
  73. package/out/builtins/tsKeywords.d.ts +23 -0
  74. package/out/builtins/tsKeywords.d.ts.map +1 -0
  75. package/out/builtins/tsKeywords.js +23 -0
  76. package/out/builtins/tsKeywords.js.map +1 -0
  77. package/out/builtins/utils/creditCard.d.ts +3 -0
  78. package/out/builtins/utils/creditCard.d.ts.map +1 -0
  79. package/out/builtins/utils/creditCard.js +35 -0
  80. package/out/builtins/utils/creditCard.js.map +1 -0
  81. package/out/builtins/utils/date.d.ts +41 -0
  82. package/out/builtins/utils/date.d.ts.map +1 -0
  83. package/out/builtins/utils/date.js +56 -0
  84. package/out/builtins/utils/date.js.map +1 -0
  85. package/out/builtins/validation.d.ts +19 -0
  86. package/out/builtins/validation.d.ts.map +1 -0
  87. package/out/builtins/validation.js +74 -0
  88. package/out/builtins/validation.js.map +1 -0
  89. package/out/config.d.ts +9 -0
  90. package/out/config.d.ts.map +1 -0
  91. package/out/config.js +18 -0
  92. package/out/config.js.map +1 -0
  93. package/out/constraints/ast.d.ts +287 -0
  94. package/out/constraints/ast.d.ts.map +1 -0
  95. package/out/constraints/ast.js +2 -0
  96. package/out/constraints/ast.js.map +1 -0
  97. package/out/constraints/constraint.d.ts +200 -0
  98. package/out/constraints/constraint.d.ts.map +1 -0
  99. package/out/constraints/constraint.js +25 -0
  100. package/out/constraints/constraint.js.map +1 -0
  101. package/out/constraints/predicate.d.ts +64 -0
  102. package/out/constraints/predicate.d.ts.map +1 -0
  103. package/out/constraints/predicate.js +52 -0
  104. package/out/constraints/predicate.js.map +1 -0
  105. package/out/constraints/props/index.d.ts +42 -0
  106. package/out/constraints/props/index.d.ts.map +1 -0
  107. package/out/constraints/props/index.js +56 -0
  108. package/out/constraints/props/index.js.map +1 -0
  109. package/out/constraints/props/optional.d.ts +37 -0
  110. package/out/constraints/props/optional.d.ts.map +1 -0
  111. package/out/constraints/props/optional.js +56 -0
  112. package/out/constraints/props/optional.js.map +1 -0
  113. package/out/constraints/props/prop.d.ts +49 -0
  114. package/out/constraints/props/prop.d.ts.map +1 -0
  115. package/out/constraints/props/prop.js +106 -0
  116. package/out/constraints/props/prop.js.map +1 -0
  117. package/out/constraints/props/props.d.ts +37 -0
  118. package/out/constraints/props/props.d.ts.map +1 -0
  119. package/out/constraints/props/props.js +121 -0
  120. package/out/constraints/props/props.js.map +1 -0
  121. package/out/constraints/props/required.d.ts +46 -0
  122. package/out/constraints/props/required.d.ts.map +1 -0
  123. package/out/constraints/props/required.js +81 -0
  124. package/out/constraints/props/required.js.map +1 -0
  125. package/out/constraints/props/sequence.d.ts +82 -0
  126. package/out/constraints/props/sequence.d.ts.map +1 -0
  127. package/out/constraints/props/sequence.js +376 -0
  128. package/out/constraints/props/sequence.js.map +1 -0
  129. package/out/constraints/props/shared.d.ts +3 -0
  130. package/out/constraints/props/shared.d.ts.map +1 -0
  131. package/out/constraints/props/shared.js +4 -0
  132. package/out/constraints/props/shared.js.map +1 -0
  133. package/out/constraints/refinements/after.d.ts +33 -0
  134. package/out/constraints/refinements/after.d.ts.map +1 -0
  135. package/out/constraints/refinements/after.js +36 -0
  136. package/out/constraints/refinements/after.js.map +1 -0
  137. package/out/constraints/refinements/before.d.ts +33 -0
  138. package/out/constraints/refinements/before.d.ts.map +1 -0
  139. package/out/constraints/refinements/before.js +43 -0
  140. package/out/constraints/refinements/before.js.map +1 -0
  141. package/out/constraints/refinements/divisor.d.ts +52 -0
  142. package/out/constraints/refinements/divisor.d.ts.map +1 -0
  143. package/out/constraints/refinements/divisor.js +52 -0
  144. package/out/constraints/refinements/divisor.js.map +1 -0
  145. package/out/constraints/refinements/exactLength.d.ts +45 -0
  146. package/out/constraints/refinements/exactLength.d.ts.map +1 -0
  147. package/out/constraints/refinements/exactLength.js +52 -0
  148. package/out/constraints/refinements/exactLength.js.map +1 -0
  149. package/out/constraints/refinements/kinds.d.ts +29 -0
  150. package/out/constraints/refinements/kinds.d.ts.map +1 -0
  151. package/out/constraints/refinements/kinds.js +17 -0
  152. package/out/constraints/refinements/kinds.js.map +1 -0
  153. package/out/constraints/refinements/length.d.ts +48 -0
  154. package/out/constraints/refinements/length.d.ts.map +1 -0
  155. package/out/constraints/refinements/length.js +53 -0
  156. package/out/constraints/refinements/length.js.map +1 -0
  157. package/out/constraints/refinements/max.d.ts +31 -0
  158. package/out/constraints/refinements/max.d.ts.map +1 -0
  159. package/out/constraints/refinements/max.js +35 -0
  160. package/out/constraints/refinements/max.js.map +1 -0
  161. package/out/constraints/refinements/maxLength.d.ts +32 -0
  162. package/out/constraints/refinements/maxLength.d.ts.map +1 -0
  163. package/out/constraints/refinements/maxLength.js +36 -0
  164. package/out/constraints/refinements/maxLength.js.map +1 -0
  165. package/out/constraints/refinements/min.d.ts +31 -0
  166. package/out/constraints/refinements/min.d.ts.map +1 -0
  167. package/out/constraints/refinements/min.js +28 -0
  168. package/out/constraints/refinements/min.js.map +1 -0
  169. package/out/constraints/refinements/minLength.d.ts +32 -0
  170. package/out/constraints/refinements/minLength.d.ts.map +1 -0
  171. package/out/constraints/refinements/minLength.js +33 -0
  172. package/out/constraints/refinements/minLength.js.map +1 -0
  173. package/out/constraints/refinements/range.d.ts +119 -0
  174. package/out/constraints/refinements/range.d.ts.map +1 -0
  175. package/out/constraints/refinements/range.js +89 -0
  176. package/out/constraints/refinements/range.js.map +1 -0
  177. package/out/constraints/refinements/regex.d.ts +47 -0
  178. package/out/constraints/refinements/regex.d.ts.map +1 -0
  179. package/out/constraints/refinements/regex.js +37 -0
  180. package/out/constraints/refinements/regex.js.map +1 -0
  181. package/out/constraints/refinements/shared.d.ts +20 -0
  182. package/out/constraints/refinements/shared.d.ts.map +1 -0
  183. package/out/constraints/refinements/shared.js +10 -0
  184. package/out/constraints/refinements/shared.js.map +1 -0
  185. package/out/generic.d.ts +22 -0
  186. package/out/generic.d.ts.map +1 -0
  187. package/out/generic.js +23 -0
  188. package/out/generic.js.map +1 -0
  189. package/out/inference.d.ts +137 -0
  190. package/out/inference.d.ts.map +1 -0
  191. package/out/inference.js +73 -0
  192. package/out/inference.js.map +1 -0
  193. package/out/keywords/ark.d.ts +70 -0
  194. package/out/keywords/ark.d.ts.map +1 -0
  195. package/out/keywords/ark.js +29 -0
  196. package/out/keywords/ark.js.map +1 -0
  197. package/out/keywords/internal.d.ts +13 -0
  198. package/out/keywords/internal.d.ts.map +1 -0
  199. package/out/keywords/internal.js +13 -0
  200. package/out/keywords/internal.js.map +1 -0
  201. package/out/keywords/jsObject.d.ts +20 -0
  202. package/out/keywords/jsObject.d.ts.map +1 -0
  203. package/out/keywords/jsObject.js +18 -0
  204. package/out/keywords/jsObject.js.map +1 -0
  205. package/out/keywords/parsing.d.ts +17 -0
  206. package/out/keywords/parsing.d.ts.map +1 -0
  207. package/out/keywords/parsing.js +64 -0
  208. package/out/keywords/parsing.js.map +1 -0
  209. package/out/keywords/root.d.ts +7 -0
  210. package/out/keywords/root.d.ts.map +1 -0
  211. package/out/keywords/root.js +4 -0
  212. package/out/keywords/root.js.map +1 -0
  213. package/out/keywords/tsGenerics.d.ts +2 -0
  214. package/out/keywords/tsGenerics.d.ts.map +1 -0
  215. package/out/keywords/tsGenerics.js +26 -0
  216. package/out/keywords/tsGenerics.js.map +1 -0
  217. package/out/keywords/tsPrimitive.d.ts +24 -0
  218. package/out/keywords/tsPrimitive.d.ts.map +1 -0
  219. package/out/keywords/tsPrimitive.js +25 -0
  220. package/out/keywords/tsPrimitive.js.map +1 -0
  221. package/out/keywords/utils/creditCard.d.ts +11 -0
  222. package/out/keywords/utils/creditCard.d.ts.map +1 -0
  223. package/out/keywords/utils/creditCard.js +35 -0
  224. package/out/keywords/utils/creditCard.js.map +1 -0
  225. package/out/keywords/utils/date.d.ts +45 -0
  226. package/out/keywords/utils/date.d.ts.map +1 -0
  227. package/out/keywords/utils/date.js +56 -0
  228. package/out/keywords/utils/date.js.map +1 -0
  229. package/out/keywords/validation.d.ts +20 -0
  230. package/out/keywords/validation.d.ts.map +1 -0
  231. package/out/keywords/validation.js +80 -0
  232. package/out/keywords/validation.js.map +1 -0
  233. package/out/kinds.d.ts +102 -0
  234. package/out/kinds.d.ts.map +1 -0
  235. package/out/kinds.js +29 -0
  236. package/out/kinds.js.map +1 -0
  237. package/out/main.d.ts +6 -6
  238. package/out/main.d.ts.map +1 -1
  239. package/out/main.js +4 -3
  240. package/out/main.js.map +1 -1
  241. package/out/match.d.ts +18 -23
  242. package/out/match.d.ts.map +1 -1
  243. package/out/match.js +3 -4
  244. package/out/match.js.map +1 -1
  245. package/out/module.d.ts +11 -0
  246. package/out/module.d.ts.map +1 -0
  247. package/out/module.js +4 -0
  248. package/out/module.js.map +1 -0
  249. package/out/parse.d.ts +29 -0
  250. package/out/parse.d.ts.map +1 -0
  251. package/out/parse.js +161 -0
  252. package/out/parse.js.map +1 -0
  253. package/out/parser/definition.d.ts +9 -12
  254. package/out/parser/definition.d.ts.map +1 -1
  255. package/out/parser/definition.js +10 -12
  256. package/out/parser/definition.js.map +1 -1
  257. package/out/parser/generic.d.ts +3 -4
  258. package/out/parser/generic.d.ts.map +1 -1
  259. package/out/parser/generic.js +6 -8
  260. package/out/parser/generic.js.map +1 -1
  261. package/out/parser/objectLiteral.d.ts +44 -12
  262. package/out/parser/objectLiteral.d.ts.map +1 -1
  263. package/out/parser/objectLiteral.js +43 -36
  264. package/out/parser/objectLiteral.js.map +1 -1
  265. package/out/parser/semantic/bounds.d.ts +9 -6
  266. package/out/parser/semantic/bounds.d.ts.map +1 -1
  267. package/out/parser/semantic/bounds.js.map +1 -1
  268. package/out/parser/semantic/divisor.d.ts +5 -6
  269. package/out/parser/semantic/divisor.d.ts.map +1 -1
  270. package/out/parser/semantic/infer.d.ts +25 -0
  271. package/out/parser/semantic/infer.d.ts.map +1 -0
  272. package/out/parser/semantic/infer.js +2 -0
  273. package/out/parser/semantic/infer.js.map +1 -0
  274. package/out/parser/semantic/utils.d.ts +3 -6
  275. package/out/parser/semantic/utils.d.ts.map +1 -1
  276. package/out/parser/semantic/validate.d.ts +14 -12
  277. package/out/parser/semantic/validate.d.ts.map +1 -1
  278. package/out/parser/semantic/validate.js +1 -0
  279. package/out/parser/semantic/validate.js.map +1 -1
  280. package/out/parser/string/reduce/dynamic.d.ts +13 -12
  281. package/out/parser/string/reduce/dynamic.d.ts.map +1 -1
  282. package/out/parser/string/reduce/dynamic.js +27 -17
  283. package/out/parser/string/reduce/dynamic.js.map +1 -1
  284. package/out/parser/string/reduce/shared.d.ts +1 -2
  285. package/out/parser/string/reduce/shared.d.ts.map +1 -1
  286. package/out/parser/string/reduce/shared.js.map +1 -1
  287. package/out/parser/string/reduce/static.d.ts +26 -22
  288. package/out/parser/string/reduce/static.d.ts.map +1 -1
  289. package/out/parser/string/shift/operand/date.d.ts +2 -1
  290. package/out/parser/string/shift/operand/date.d.ts.map +1 -1
  291. package/out/parser/string/shift/operand/date.js +2 -2
  292. package/out/parser/string/shift/operand/date.js.map +1 -1
  293. package/out/parser/string/shift/operand/enclosed.d.ts +2 -2
  294. package/out/parser/string/shift/operand/enclosed.d.ts.map +1 -1
  295. package/out/parser/string/shift/operand/enclosed.js +6 -4
  296. package/out/parser/string/shift/operand/enclosed.js.map +1 -1
  297. package/out/parser/string/shift/operand/genericArgs.d.ts +9 -9
  298. package/out/parser/string/shift/operand/genericArgs.d.ts.map +1 -1
  299. package/out/parser/string/shift/operand/genericArgs.js +6 -8
  300. package/out/parser/string/shift/operand/genericArgs.js.map +1 -1
  301. package/out/parser/string/shift/operand/operand.d.ts +3 -3
  302. package/out/parser/string/shift/operand/operand.d.ts.map +1 -1
  303. package/out/parser/string/shift/operand/operand.js +8 -11
  304. package/out/parser/string/shift/operand/operand.js.map +1 -1
  305. package/out/parser/string/shift/operand/unenclosed.d.ts +13 -20
  306. package/out/parser/string/shift/operand/unenclosed.d.ts.map +1 -1
  307. package/out/parser/string/shift/operand/unenclosed.js +21 -26
  308. package/out/parser/string/shift/operand/unenclosed.js.map +1 -1
  309. package/out/parser/string/shift/operator/bounds.d.ts +15 -12
  310. package/out/parser/string/shift/operator/bounds.d.ts.map +1 -1
  311. package/out/parser/string/shift/operator/bounds.js +42 -48
  312. package/out/parser/string/shift/operator/bounds.js.map +1 -1
  313. package/out/parser/string/shift/operator/divisor.d.ts +1 -2
  314. package/out/parser/string/shift/operator/divisor.d.ts.map +1 -1
  315. package/out/parser/string/shift/operator/divisor.js.map +1 -1
  316. package/out/parser/string/shift/operator/operator.d.ts +1 -1
  317. package/out/parser/string/shift/operator/operator.d.ts.map +1 -1
  318. package/out/parser/string/shift/operator/operator.js +12 -18
  319. package/out/parser/string/shift/operator/operator.js.map +1 -1
  320. package/out/parser/string/shift/scanner.d.ts +2 -1
  321. package/out/parser/string/shift/scanner.d.ts.map +1 -1
  322. package/out/parser/string/shift/scanner.js +12 -11
  323. package/out/parser/string/shift/scanner.js.map +1 -1
  324. package/out/parser/string/string.d.ts +8 -5
  325. package/out/parser/string/string.d.ts.map +1 -1
  326. package/out/parser/string/string.js.map +1 -1
  327. package/out/parser/tuple.d.ts +96 -37
  328. package/out/parser/tuple.d.ts.map +1 -1
  329. package/out/parser/tuple.js +61 -66
  330. package/out/parser/tuple.js.map +1 -1
  331. package/out/schema.d.ts +175 -0
  332. package/out/schema.d.ts.map +1 -0
  333. package/out/schema.js +73 -0
  334. package/out/schema.js.map +1 -0
  335. package/out/schemaScope.d.ts +180 -0
  336. package/out/schemaScope.d.ts.map +1 -0
  337. package/out/schemaScope.js +235 -0
  338. package/out/schemaScope.js.map +1 -0
  339. package/out/scope.d.ts +42 -114
  340. package/out/scope.d.ts.map +1 -1
  341. package/out/scope.js +51 -181
  342. package/out/scope.js.map +1 -1
  343. package/out/shared/compile.d.ts +22 -0
  344. package/out/shared/compile.d.ts.map +1 -0
  345. package/out/shared/compile.js +79 -0
  346. package/out/shared/compile.js.map +1 -0
  347. package/out/shared/context.d.ts +54 -0
  348. package/out/shared/context.d.ts.map +1 -0
  349. package/out/shared/context.js +53 -0
  350. package/out/shared/context.js.map +1 -0
  351. package/out/shared/declare.d.ts +69 -0
  352. package/out/shared/declare.d.ts.map +1 -0
  353. package/out/shared/declare.js +2 -0
  354. package/out/shared/declare.js.map +1 -0
  355. package/out/shared/disjoint.d.ts +91 -0
  356. package/out/shared/disjoint.d.ts.map +1 -0
  357. package/out/shared/disjoint.js +110 -0
  358. package/out/shared/disjoint.js.map +1 -0
  359. package/out/shared/errors.d.ts +99 -0
  360. package/out/shared/errors.d.ts.map +1 -0
  361. package/out/shared/errors.js +108 -0
  362. package/out/shared/errors.js.map +1 -0
  363. package/out/shared/implement.d.ts +363 -0
  364. package/out/shared/implement.d.ts.map +1 -0
  365. package/out/shared/implement.js +68 -0
  366. package/out/shared/implement.js.map +1 -0
  367. package/out/shared/inference.d.ts +6 -0
  368. package/out/shared/inference.d.ts.map +1 -0
  369. package/out/shared/inference.js +5 -0
  370. package/out/shared/inference.js.map +1 -0
  371. package/out/shared/intersections.d.ts +60 -0
  372. package/out/shared/intersections.d.ts.map +1 -0
  373. package/out/shared/intersections.js +2 -0
  374. package/out/shared/intersections.js.map +1 -0
  375. package/out/shared/traversal.d.ts +62 -0
  376. package/out/shared/traversal.d.ts.map +1 -0
  377. package/out/shared/traversal.js +97 -0
  378. package/out/shared/traversal.js.map +1 -0
  379. package/out/shared/utils.d.ts +24 -0
  380. package/out/shared/utils.d.ts.map +1 -0
  381. package/out/shared/utils.js +15 -0
  382. package/out/shared/utils.js.map +1 -0
  383. package/out/type.d.ts +23 -59
  384. package/out/type.d.ts.map +1 -1
  385. package/out/type.js +2 -137
  386. package/out/type.js.map +1 -1
  387. package/out/types/basis.d.ts +47 -0
  388. package/out/types/basis.d.ts.map +1 -0
  389. package/out/types/basis.js +15 -0
  390. package/out/types/basis.js.map +1 -0
  391. package/out/types/discriminate.d.ts +34 -0
  392. package/out/types/discriminate.d.ts.map +1 -0
  393. package/out/types/discriminate.js +120 -0
  394. package/out/types/discriminate.js.map +1 -0
  395. package/out/types/domain.d.ts +57 -0
  396. package/out/types/domain.d.ts.map +1 -0
  397. package/out/types/domain.js +41 -0
  398. package/out/types/domain.js.map +1 -0
  399. package/out/types/intersection.d.ts +127 -0
  400. package/out/types/intersection.d.ts.map +1 -0
  401. package/out/types/intersection.js +379 -0
  402. package/out/types/intersection.js.map +1 -0
  403. package/out/types/morph.d.ts +157 -0
  404. package/out/types/morph.d.ts.map +1 -0
  405. package/out/types/morph.js +99 -0
  406. package/out/types/morph.js.map +1 -0
  407. package/out/types/proto.d.ts +51 -0
  408. package/out/types/proto.d.ts.map +1 -0
  409. package/out/types/proto.js +60 -0
  410. package/out/types/proto.js.map +1 -0
  411. package/out/types/type.d.ts +143 -0
  412. package/out/types/type.d.ts.map +1 -0
  413. package/out/types/type.js +123 -0
  414. package/out/types/type.js.map +1 -0
  415. package/out/types/union.d.ts +71 -0
  416. package/out/types/union.d.ts.map +1 -0
  417. package/out/types/union.js +379 -0
  418. package/out/types/union.js.map +1 -0
  419. package/out/types/unit.d.ts +45 -0
  420. package/out/types/unit.d.ts.map +1 -0
  421. package/out/types/unit.js +56 -0
  422. package/out/types/unit.js.map +1 -0
  423. package/out/util.d.ts +30 -18
  424. package/out/util.d.ts.map +1 -1
  425. package/out/util.js +8 -7
  426. package/out/util.js.map +1 -1
  427. package/package.json +7 -3
  428. package/parser/definition.ts +73 -89
  429. package/parser/generic.ts +35 -36
  430. package/parser/objectLiteral.ts +143 -117
  431. package/parser/semantic/bounds.ts +33 -32
  432. package/parser/semantic/divisor.ts +8 -10
  433. package/parser/semantic/infer.ts +141 -0
  434. package/parser/semantic/utils.ts +12 -23
  435. package/parser/semantic/validate.ts +82 -73
  436. package/parser/string/reduce/dynamic.ts +61 -46
  437. package/parser/string/reduce/shared.ts +1 -3
  438. package/parser/string/reduce/static.ts +65 -67
  439. package/parser/string/shift/operand/date.ts +12 -8
  440. package/parser/string/shift/operand/enclosed.ts +22 -17
  441. package/parser/string/shift/operand/genericArgs.ts +46 -45
  442. package/parser/string/shift/operand/operand.ts +32 -38
  443. package/parser/string/shift/operand/unenclosed.ts +106 -147
  444. package/parser/string/shift/operator/bounds.ts +114 -106
  445. package/parser/string/shift/operator/divisor.ts +12 -14
  446. package/parser/string/shift/operator/operator.ts +35 -46
  447. package/parser/string/shift/scanner.ts +49 -46
  448. package/parser/string/string.ts +28 -32
  449. package/parser/tuple.ts +288 -308
  450. package/scope.ts +183 -425
  451. package/type.ts +82 -281
  452. package/__tests__/astUtils.test.ts +0 -17
  453. package/__tests__/jsdoc.test.ts +0 -64
  454. package/__tests__/nodeDefinitions.test.ts +0 -190
  455. package/__tests__/typeMethods.test.ts +0 -69
  456. package/out/arkConfig.d.ts +0 -2
  457. package/out/arkConfig.d.ts.map +0 -1
  458. package/out/arkConfig.js +0 -10
  459. package/out/arkConfig.js.map +0 -1
  460. package/out/parser/semantic/intersections.d.ts +0 -14
  461. package/out/parser/semantic/intersections.d.ts.map +0 -1
  462. package/out/parser/semantic/intersections.js +0 -2
  463. package/out/parser/semantic/intersections.js.map +0 -1
  464. package/out/parser/semantic/semantic.d.ts +0 -32
  465. package/out/parser/semantic/semantic.d.ts.map +0 -1
  466. package/out/parser/semantic/semantic.js +0 -2
  467. package/out/parser/semantic/semantic.js.map +0 -1
  468. package/out/parser/shared.d.ts +0 -62
  469. package/out/parser/shared.d.ts.map +0 -1
  470. package/out/parser/shared.js +0 -56
  471. package/out/parser/shared.js.map +0 -1
  472. package/out/test.d.ts +0 -2
  473. package/out/test.d.ts.map +0 -1
  474. package/out/test.js +0 -7
  475. package/out/test.js.map +0 -1
  476. package/out/tsconfig.build.tsbuildinfo +0 -1
  477. package/parser/semantic/semantic.ts +0 -143
  478. package/parser/shared.ts +0 -170
  479. package/util.ts +0 -36
@@ -0,0 +1,51 @@
1
+ import { type Constructor } from "@arktype/util"
2
+ import type { BaseMeta, declareNode } from "../shared/declare.js"
3
+ import type { TraverseAllows } from "../shared/traversal.js"
4
+ import { BaseBasis } from "./basis.js"
5
+ export interface ProtoInner<proto extends Constructor = Constructor>
6
+ extends BaseMeta {
7
+ readonly proto: proto
8
+ }
9
+ export type NormalizedProtoSchema<proto extends Constructor = Constructor> =
10
+ ProtoInner<proto>
11
+ export type ProtoSchema<proto extends Constructor = Constructor> =
12
+ | proto
13
+ | NormalizedProtoSchema<proto>
14
+ export type ProtoDeclaration = declareNode<{
15
+ kind: "proto"
16
+ schema: ProtoSchema
17
+ normalizedSchema: NormalizedProtoSchema
18
+ inner: ProtoInner
19
+ errorContext: ProtoInner
20
+ }>
21
+ export declare class ProtoNode<t = any, $ = any> extends BaseBasis<
22
+ t,
23
+ ProtoDeclaration,
24
+ $
25
+ > {
26
+ static implementation: import("../shared/implement.js").nodeImplementationOf<{
27
+ reducibleTo: "proto"
28
+ intersectionIsOpen: false
29
+ prerequisite: unknown
30
+ childKind: never
31
+ kind: "proto"
32
+ schema: ProtoSchema<Constructor>
33
+ normalizedSchema: NormalizedProtoSchema<Constructor>
34
+ inner: ProtoInner<Constructor>
35
+ errorContext: ProtoInner<Constructor> &
36
+ import("../shared/declare.js").BaseErrorContext<"proto">
37
+ }>
38
+ traverseAllows: TraverseAllows
39
+ readonly expression: string
40
+ readonly serializedConstructor: string
41
+ readonly domain = "object"
42
+ readonly compiledCondition: string
43
+ readonly compiledNegation: string
44
+ readonly errorContext: {
45
+ code: "proto"
46
+ readonly proto: Constructor
47
+ readonly description?: string
48
+ }
49
+ readonly literalKeys: (string | symbol)[]
50
+ }
51
+ //# sourceMappingURL=proto.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"proto.d.ts","sourceRoot":"","sources":["../../types/proto.ts"],"names":[],"mappings":"AAAA,OAAO,EAMN,KAAK,WAAW,EAChB,MAAM,eAAe,CAAA;AACtB,OAAO,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAGjE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAEtC,MAAM,WAAW,UAAU,CAAC,KAAK,SAAS,WAAW,GAAG,WAAW,CAClE,SAAQ,QAAQ;IAChB,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAA;CACrB;AAED,MAAM,MAAM,qBAAqB,CAAC,KAAK,SAAS,WAAW,GAAG,WAAW,IACxE,UAAU,CAAC,KAAK,CAAC,CAAA;AAElB,MAAM,MAAM,WAAW,CAAC,KAAK,SAAS,WAAW,GAAG,WAAW,IAC5D,KAAK,GACL,qBAAqB,CAAC,KAAK,CAAC,CAAA;AAE/B,MAAM,MAAM,gBAAgB,GAAG,WAAW,CAAC;IAC1C,IAAI,EAAE,OAAO,CAAA;IACb,MAAM,EAAE,WAAW,CAAA;IACnB,gBAAgB,EAAE,qBAAqB,CAAA;IACvC,KAAK,EAAE,UAAU,CAAA;IACjB,YAAY,EAAE,UAAU,CAAA;CACxB,CAAC,CAAA;AAEF,qBAAa,SAAS,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,GAAG,GAAG,CAAE,SAAQ,SAAS,CACzD,CAAC,EACD,gBAAgB,EAChB,CAAC,CACD;IACA,MAAM,CAAC,cAAc;;;;;;;;;;OAoCnB;IAEF,cAAc,EAAE,cAAc,CAAuC;IAErE,QAAQ,CAAC,UAAU,SAAuB;IAC1C,QAAQ,CAAC,qBAAqB,SAAyC;IACvE,QAAQ,CAAC,MAAM,YAAW;IAE1B,QAAQ,CAAC,iBAAiB,SAAkD;IAC5E,QAAQ,CAAC,gBAAgB,SAAiC;IAE1D,QAAQ,CAAC,YAAY;;;;MAAsC;IAC3D,QAAQ,CAAC,WAAW,sBAAwC;CAC5D"}
@@ -0,0 +1,60 @@
1
+ import {
2
+ constructorExtends,
3
+ getExactBuiltinConstructorName,
4
+ objectKindDescriptions,
5
+ objectKindOrDomainOf,
6
+ prototypeKeysOf
7
+ } from "@arktype/util"
8
+ import { Disjoint } from "../shared/disjoint.js"
9
+ import { defaultValueSerializer } from "../shared/implement.js"
10
+ import { BaseBasis } from "./basis.js"
11
+ export class ProtoNode extends BaseBasis {
12
+ static implementation = this.implement({
13
+ hasAssociatedError: true,
14
+ collapsibleKey: "proto",
15
+ keys: {
16
+ proto: {
17
+ serialize: (constructor) =>
18
+ getExactBuiltinConstructorName(constructor) ??
19
+ defaultValueSerializer(constructor)
20
+ }
21
+ },
22
+ normalize: (input) =>
23
+ typeof input === "function" ? { proto: input } : input,
24
+ defaults: {
25
+ description(node) {
26
+ const knownObjectKind = getExactBuiltinConstructorName(
27
+ node.proto
28
+ )
29
+ return knownObjectKind
30
+ ? objectKindDescriptions[knownObjectKind]
31
+ : `an instance of ${node.proto.name}`
32
+ },
33
+ actual(data) {
34
+ return objectKindOrDomainOf(data)
35
+ }
36
+ },
37
+ intersections: {
38
+ proto: (l, r) =>
39
+ constructorExtends(l.proto, r.proto)
40
+ ? l
41
+ : constructorExtends(r.proto, l.proto)
42
+ ? r
43
+ : Disjoint.from("proto", l, r),
44
+ domain: (proto, domain) =>
45
+ domain.domain === "object"
46
+ ? proto
47
+ : // TODO: infer node to avoid cast
48
+ Disjoint.from("domain", proto.$.keywords.object, domain)
49
+ }
50
+ })
51
+ traverseAllows = (data) => data instanceof this.proto
52
+ expression = `${this.proto.name}`
53
+ serializedConstructor = this.json.proto
54
+ domain = "object"
55
+ compiledCondition = `data instanceof ${this.serializedConstructor}`
56
+ compiledNegation = `!(${this.compiledCondition})`
57
+ errorContext = this.createErrorContext(this.inner)
58
+ literalKeys = prototypeKeysOf(this.proto.prototype)
59
+ }
60
+ //# sourceMappingURL=proto.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"proto.js","sourceRoot":"","sources":["../../types/proto.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,kBAAkB,EAClB,8BAA8B,EAC9B,sBAAsB,EACtB,oBAAoB,EACpB,eAAe,EAEf,MAAM,eAAe,CAAA;AAEtB,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAChD,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAA;AAE/D,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAsBtC,MAAM,OAAO,SAA4B,SAAQ,SAIhD;IACA,MAAM,CAAC,cAAc,GAAG,IAAI,CAAC,SAAS,CAAC;QACtC,kBAAkB,EAAE,IAAI;QACxB,cAAc,EAAE,OAAO;QACvB,IAAI,EAAE;YACL,KAAK,EAAE;gBACN,SAAS,EAAE,CAAC,WAAW,EAAE,EAAE,CAC1B,8BAA8B,CAAC,WAAW,CAAC;oBAC3C,sBAAsB,CAAC,WAAW,CAAC;aACpC;SACD;QACD,SAAS,EA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,EAAE,CAAA;IACjC,qBAAqB,GAAI,IAAI,CAAC,IAA0B,CAAC,KAAK,CAAA;IAC9D,MAAM,GAAG,QAAQ,CAAA;IAEjB,iBAAiB,GAAG,mBAAmB,IAAI,CAAC,qBAAqB,EAAE,CAAA;IACnE,gBAAgB,GAAG,KAAK,IAAI,CAAC,iBAAiB,GAAG,CAAA;IAEjD,YAAY,GAAG,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;IAClD,WAAW,GAAG,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAA"}
@@ -0,0 +1,143 @@
1
+ import { type Domain, type conform } from "@arktype/util"
2
+ import { BaseNode, type Node } from "../base.js"
3
+ import type { constrain } from "../constraints/ast.js"
4
+ import { type PrimitiveConstraintKind } from "../constraints/constraint.js"
5
+ import type { Predicate, inferNarrow } from "../constraints/predicate.js"
6
+ import type { Schema, reducibleKindOf } from "../kinds.js"
7
+ import type { BaseMeta, BaseNodeDeclaration } from "../shared/declare.js"
8
+ import { Disjoint } from "../shared/disjoint.js"
9
+ import {
10
+ type ConstraintKind,
11
+ type NodeKind,
12
+ type TypeIntersection,
13
+ type TypeKind,
14
+ type kindRightOf
15
+ } from "../shared/implement.js"
16
+ import type { inferred } from "../shared/inference.js"
17
+ import type { inferIntersection } from "../shared/intersections.js"
18
+ import type { inferTypeRoot, validateTypeRoot } from "../type.js"
19
+ import type { IntersectionNode, constraintKindOf } from "./intersection.js"
20
+ import type {
21
+ Morph,
22
+ Out,
23
+ distillConstrainableOut,
24
+ includesMorphs,
25
+ inferMorphOut
26
+ } from "./morph.js"
27
+ import type { UnionChildKind, UnionNode } from "./union.js"
28
+ export declare const defineRightwardIntersections: <
29
+ kind extends
30
+ | "union"
31
+ | "morph"
32
+ | "unit"
33
+ | "intersection"
34
+ | "proto"
35
+ | "domain"
36
+ >(
37
+ kind: kind,
38
+ implementation: TypeIntersection<
39
+ kind,
40
+ Extract<
41
+ kindRightOf<kind>,
42
+ "union" | "morph" | "unit" | "intersection" | "proto" | "domain"
43
+ >
44
+ >
45
+ ) => {
46
+ [k in Extract<
47
+ kindRightOf<kind>,
48
+ "union" | "morph" | "unit" | "intersection" | "proto" | "domain"
49
+ >]: TypeIntersection<kind, k>
50
+ }
51
+ export interface BaseTypeDeclaration extends BaseNodeDeclaration {
52
+ kind: TypeKind
53
+ }
54
+ export interface Type<out t = any, $ = any>
55
+ extends BaseType<t, BaseTypeDeclaration, $> {}
56
+ export declare abstract class BaseType<
57
+ t,
58
+ d extends BaseTypeDeclaration,
59
+ $ = any
60
+ > extends BaseNode<t, d> {
61
+ readonly branches: readonly Node<UnionChildKind>[]
62
+ private keyofCache
63
+ keyof(): Type<keyof this["in"]["infer"], $>
64
+ abstract rawKeyOf(): Type
65
+ intersect<r extends Type>(
66
+ r: r
67
+ ): Type<inferIntersection<this["infer"], r["infer"]>, t> | Disjoint
68
+ and<def>(
69
+ def: validateTypeRoot<def, $>
70
+ ): Type<inferIntersection<t, inferTypeRoot<def, $>>, $>
71
+ or<def>(def: validateTypeRoot<def, $>): Type<t | inferTypeRoot<def, $>, $>
72
+ isUnknown(): this is IntersectionNode<unknown>
73
+ isNever(): this is UnionNode<never>
74
+ get<key extends PropertyKey>(...path: readonly (key | Type<key>)[]): this
75
+ extract(other: Type): Type
76
+ exclude(other: Type): Type
77
+ array(): Type<t[], $>
78
+ extends<r>(other: Type<r>): this is Type<r, $> & {
79
+ [inferred]?: r
80
+ }
81
+ configure(configOrDescription: BaseMeta | string): this
82
+ describe(description: string): this
83
+ from(literal: this["in"]["infer"]): this["out"]["infer"]
84
+ morph<morph extends Morph<this["infer"]>>(
85
+ morph: morph
86
+ ): Type<
87
+ (In: this["in"]["infer"]) => Out<inferMorphOut<ReturnType<morph>>>,
88
+ $
89
+ >
90
+ morph<morph extends Morph<this["infer"]>, def>(
91
+ morph: morph,
92
+ outValidator: validateTypeRoot<def, $>
93
+ ): Type<
94
+ (
95
+ In: this["in"][typeof inferred]
96
+ ) => Out<distillConstrainableOut<inferTypeRoot<def, $>>>,
97
+ $
98
+ >
99
+ narrow<def extends Predicate<distillConstrainableOut<t>>>(
100
+ def: def
101
+ ): Type<
102
+ includesMorphs<t> extends true
103
+ ? (In: this["in"]["infer"]) => Out<inferNarrow<this["infer"], def>>
104
+ : inferNarrow<this["infer"], def>,
105
+ $
106
+ >
107
+ assert(data: unknown): this["infer"]
108
+ constrain<
109
+ kind extends PrimitiveConstraintKind,
110
+ const schema extends Schema<kind>
111
+ >(
112
+ kind: conform<kind, constraintKindOf<this["in"]["infer"]>>,
113
+ schema: schema
114
+ ): Type<constrain<t, kind, schema>, $>
115
+ protected rawConstrain(kind: ConstraintKind, schema: unknown): Type
116
+ }
117
+ export type intersectType<l extends TypeKind, r extends NodeKind> = [
118
+ l,
119
+ r
120
+ ] extends [r, l]
121
+ ? l
122
+ : asymmetricIntersectionOf<l, r> | asymmetricIntersectionOf<r, l>
123
+ type asymmetricIntersectionOf<
124
+ l extends NodeKind,
125
+ r extends NodeKind
126
+ > = l extends unknown
127
+ ? r extends kindRightOf<l>
128
+ ? l | reducibleKindOf<l>
129
+ : never
130
+ : never
131
+ export interface BaseBasis {
132
+ basisName: string
133
+ domain: Domain
134
+ }
135
+ export type typeKindRightOf<kind extends TypeKind> = Extract<
136
+ kindRightOf<kind>,
137
+ TypeKind
138
+ >
139
+ export type typeKindOrRightOf<kind extends TypeKind> =
140
+ | kind
141
+ | typeKindRightOf<kind>
142
+ export {}
143
+ //# sourceMappingURL=type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../types/type.ts"],"names":[],"mappings":"AAAA,OAAO,EAGN,KAAK,MAAM,EACX,KAAK,OAAO,EACZ,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,QAAQ,EAAE,KAAK,IAAI,EAAE,MAAM,YAAY,CAAA;AAChD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAA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AI,SAAS,QAAQ,IAAI,OAAO,CAC3D,WAAW,CAAC,IAAI,CAAC,EACjB,QAAQ,CACR,CAAA;AAED,MAAM,MAAM,iBAAiB,CAAC,IAAI,SAAS,QAAQ,IAChD,IAAI,GACJ,eAAe,CAAC,IAAI,CAAC,CAAA"}
@@ -0,0 +1,123 @@
1
+ import { flatMorph, throwParseError } from "@arktype/util"
2
+ import { BaseNode } from "../base.js"
3
+ import { throwInvalidOperandError } from "../constraints/constraint.js"
4
+ import { Disjoint } from "../shared/disjoint.js"
5
+ import { typeKindsRightOf } from "../shared/implement.js"
6
+ export const defineRightwardIntersections = (kind, implementation) =>
7
+ flatMorph(typeKindsRightOf(kind), (i, kind) => [kind, implementation])
8
+ export class BaseType extends BaseNode {
9
+ branches = this.hasKind("union") ? this.inner.branches : [this]
10
+ keyofCache
11
+ keyof() {
12
+ if (!this.keyofCache) {
13
+ this.keyofCache = this.rawKeyOf()
14
+ if (this.keyofCache.isNever())
15
+ throwParseError(
16
+ `keyof ${this.expression} results in an unsatisfiable type`
17
+ )
18
+ }
19
+ return this.keyofCache
20
+ }
21
+ intersect(r) {
22
+ return this.intersectInternal(r)
23
+ }
24
+ and(def) {
25
+ const result = this.intersect(this.$.parseTypeRoot(def))
26
+ return result instanceof Disjoint ? result.throw() : result
27
+ }
28
+ or(def) {
29
+ const branches = [
30
+ ...this.branches,
31
+ ...this.$.parseTypeRoot(def).branches
32
+ ]
33
+ return this.$.node(branches)
34
+ }
35
+ isUnknown() {
36
+ return this.hasKind("intersection") && this.children.length === 0
37
+ }
38
+ isNever() {
39
+ return this.hasKind("union") && this.branches.length === 0
40
+ }
41
+ get(...path) {
42
+ return this
43
+ }
44
+ extract(other) {
45
+ return this.$.node(
46
+ this.branches.filter((branch) => branch.extends(other)),
47
+ { root: true }
48
+ )
49
+ }
50
+ exclude(other) {
51
+ return this.$.node(
52
+ this.branches.filter((branch) => !branch.extends(other)),
53
+ { root: true }
54
+ )
55
+ }
56
+ array() {
57
+ return this.$.node(
58
+ {
59
+ proto: Array,
60
+ sequence: this
61
+ },
62
+ { prereduced: true, root: true }
63
+ )
64
+ }
65
+ // add the extra inferred intersection so that a variable of Type
66
+ // can be narrowed without other branches becoming never
67
+ extends(other) {
68
+ const intersection = this.intersect(other)
69
+ return !(intersection instanceof Disjoint) && this.equals(intersection)
70
+ }
71
+ configure(configOrDescription) {
72
+ return this.configureShallowDescendants(configOrDescription)
73
+ }
74
+ describe(description) {
75
+ return this.configure(description)
76
+ }
77
+ // TODO: should return out
78
+ from(literal) {
79
+ return literal
80
+ }
81
+ morph(morph, outValidator) {
82
+ if (this.hasKind("union")) {
83
+ const branches = this.branches.map((node) =>
84
+ node.morph(morph, outValidator)
85
+ )
86
+ return this.$.node("union", { ...this.inner, branches })
87
+ }
88
+ if (this.hasKind("morph")) {
89
+ return this.$.node("morph", {
90
+ ...this.inner,
91
+ morphs: [...this.morphs, morph]
92
+ })
93
+ }
94
+ return this.$.node("morph", {
95
+ in: this,
96
+ morphs: [morph]
97
+ })
98
+ }
99
+ // TODO: based on below, should maybe narrow morph output if used after
100
+ narrow(def) {
101
+ return this.rawConstrain("predicate", def)
102
+ }
103
+ assert(data) {
104
+ const result = this(data)
105
+ return result.errors ? result.errors.throw() : result.out
106
+ }
107
+ constrain(kind, schema) {
108
+ return this.rawConstrain(kind, schema)
109
+ }
110
+ rawConstrain(kind, schema) {
111
+ const constraint = this.$.node(kind, schema)
112
+ if (constraint.impliedBasis && !this.extends(constraint.impliedBasis)) {
113
+ return throwInvalidOperandError(kind, constraint.impliedBasis, this)
114
+ }
115
+ return this.and(
116
+ // TODO: not an intersection
117
+ this.$.node("intersection", {
118
+ [kind]: constraint
119
+ })
120
+ )
121
+ }
122
+ }
123
+ //# sourceMappingURL=type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.js","sourceRoot":"","sources":["../../types/type.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,SAAS,EACT,eAAe,EAGf,MAAM,eAAe,CAAA;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,EAAE;YAC3B,EAAE,EAAE,IAAI;YACR,MAAM,EAAE,CAAC,KAAK,CAAC;SACf,CAAC,CAAA;IACH,CAAC;IAED,uEAAuE;IACvE,MAAM,CACL,GAAQ;QAOR,OAAO,IAAI,CAAC,YAAY,CAAC,WAAW,EAAE,GAAG,CAAU,CAAA;IACpD,CAAC;IAED,MAAM,CAAC,IAAa;QACnB,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,CAAA;QACzB,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAA;IAC1D,CAAC;IAED,SAAS,CAIR,IAA0D,EAC1D,MAAc;QAEd,OAAO,IAAI,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAU,CAAA;IAChD,CAAC;IAES,YAAY,CAAC,IAAoB,EAAE,MAAe;QAC3D,MAAM,UAAU,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,MAAe,CAAC,CAAA;QACrD,IACC,UAAU,CAAC,YAAY;YACvB,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,YAAqB,CAAC,EAC9C,CAAC;YACF,OAAO,wBAAwB,CAC9B,IAAI,EACJ,UAAU,CAAC,YAAY,EACvB,IAAa,CACb,CAAA;QACF,CAAC;QAED,OAAO,IAAI,CAAC,GAAG;QACd,4BAA4B;QAC5B,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,cAAc,EAAE;YAC3B,CAAC,IAAI,CAAC,EAAE,UAAU;SAClB,CAAC,CACO,CAAA;IACX,CAAC;CACD"}
@@ -0,0 +1,71 @@
1
+ import type { Node } from "../base.js"
2
+ import type { Schema } from "../kinds.js"
3
+ import type { NodeCompiler } from "../shared/compile.js"
4
+ import type { BaseMeta, declareNode } from "../shared/declare.js"
5
+ import { Disjoint } from "../shared/disjoint.js"
6
+ import type { ArkTypeError } from "../shared/errors.js"
7
+ import {
8
+ type TypeKind,
9
+ type nodeImplementationOf
10
+ } from "../shared/implement.js"
11
+ import type { TraverseAllows, TraverseApply } from "../shared/traversal.js"
12
+ import type { Discriminant } from "./discriminate.js"
13
+ import { BaseType, type Type, type typeKindRightOf } from "./type.js"
14
+ export type UnionChildKind = typeKindRightOf<"union">
15
+ export declare const unionChildKinds: (
16
+ | "morph"
17
+ | "unit"
18
+ | "intersection"
19
+ | "proto"
20
+ | "domain"
21
+ )[]
22
+ export type UnionChildSchema = Schema<UnionChildKind>
23
+ export type UnionChildNode = Node<UnionChildKind>
24
+ export type UnionSchema<
25
+ branches extends readonly UnionChildSchema[] = readonly UnionChildSchema[]
26
+ > = NormalizedUnionSchema<branches> | branches
27
+ export interface NormalizedUnionSchema<
28
+ branches extends readonly UnionChildSchema[] = readonly UnionChildSchema[]
29
+ > extends BaseMeta {
30
+ readonly branches: branches
31
+ readonly ordered?: true
32
+ }
33
+ export interface UnionInner extends BaseMeta {
34
+ readonly branches: readonly UnionChildNode[]
35
+ readonly ordered?: true
36
+ }
37
+ export type UnionDeclaration = declareNode<{
38
+ kind: "union"
39
+ schema: UnionSchema
40
+ normalizedSchema: NormalizedUnionSchema
41
+ inner: UnionInner
42
+ errorContext: {
43
+ errors: readonly ArkTypeError[]
44
+ }
45
+ reducibleTo: TypeKind
46
+ childKind: UnionChildKind
47
+ }>
48
+ export declare class UnionNode<t = any, $ = any> extends BaseType<
49
+ t,
50
+ UnionDeclaration,
51
+ $
52
+ > {
53
+ static implementation: nodeImplementationOf<UnionDeclaration>
54
+ readonly discriminant: Discriminant | null
55
+ readonly isBoolean: boolean
56
+ readonly expression: string
57
+ traverseAllows: TraverseAllows
58
+ traverseApply: TraverseApply
59
+ compile(js: NodeCompiler): void
60
+ rawKeyOf(): Type
61
+ get nestableExpression(): string
62
+ }
63
+ export declare const intersectBranches: (
64
+ l: readonly UnionChildNode[],
65
+ r: readonly UnionChildNode[]
66
+ ) => readonly UnionChildNode[] | Disjoint
67
+ export declare const reduceBranches: ({
68
+ branches,
69
+ ordered
70
+ }: UnionInner) => readonly UnionChildNode[]
71
+ //# sourceMappingURL=union.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"union.d.ts","sourceRoot":"","sources":["../../types/union.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AACtC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACzC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AACxD,OAAO,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AACjE,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAChD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AACvD,OAAO,EAEN,KAAK,QAAQ,EACb,KAAK,oBAAoB,EACzB,MAAM,wBAAwB,CAAA;AAC/B,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAA;AAC3E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AACrD,OAAO,EACN,QAAQ,EAER,KAAK,IAAI,EACT,KAAK,eAAe,EACpB,MAAM,WAAW,CAAA;AAElB,MAAM,MAAM,cAAc,GAAG,eAAe,CAAC,OAAO,CAAC,CAAA;AAErD,eAAO,MAAM,eAAe,4DAA4B,CAAA;AAExD,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC,cAAc,CAAC,CAAA;AAErD,MAAM,MAAM,cAAc,GAAG,IAAI,CAAC,cAAc,CAAC,CAAA;AAEjD,MAAM,MAAM,WAAW,CACtB,QAAQ,SAAS,SAAS,gBAAgB,EAAE,GAAG,SAAS,gBAAgB,EAAE,IACvE,qBAAqB,CAAC,QAAQ,CAAC,GAAG,QAAQ,CAAA;AAE9C,MAAM,WAAW,qBAAqB,CACrC,QAAQ,SAAS,SA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