arktype 2.0.0-dev.8 → 2.0.0-dev.9

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 (379) hide show
  1. package/__tests__/config.test.ts +11 -0
  2. package/__tests__/imports.test.ts +18 -12
  3. package/__tests__/literal.test.ts +30 -14
  4. package/__tests__/narrow.test.ts +2 -2
  5. package/__tests__/objectLiteral.test.ts +130 -7
  6. package/__tests__/pipe.test.ts +1 -1
  7. package/__tests__/scope.test.ts +197 -0
  8. package/__tests__/traverse.test.ts +13 -5
  9. package/out/ark.d.ts +1 -2
  10. package/out/ark.js +0 -1
  11. package/out/generic.d.ts +0 -1
  12. package/out/generic.js +0 -1
  13. package/out/main.d.ts +0 -1
  14. package/out/main.js +0 -1
  15. package/out/match.d.ts +0 -1
  16. package/out/match.js +0 -1
  17. package/out/module.d.ts +0 -1
  18. package/out/module.js +0 -1
  19. package/out/parser/definition.d.ts +1 -2
  20. package/out/parser/definition.js +0 -1
  21. package/out/parser/generic.d.ts +2 -3
  22. package/out/parser/generic.js +0 -1
  23. package/out/parser/generic.js.map +1 -1
  24. package/out/parser/objectLiteral.d.ts +1 -2
  25. package/out/parser/objectLiteral.js +15 -8
  26. package/out/parser/objectLiteral.js.map +1 -1
  27. package/out/parser/semantic/bounds.d.ts +1 -2
  28. package/out/parser/semantic/bounds.js +0 -1
  29. package/out/parser/semantic/divisor.d.ts +0 -1
  30. package/out/parser/semantic/divisor.js +0 -2
  31. package/out/parser/semantic/infer.d.ts +0 -1
  32. package/out/parser/semantic/infer.js +0 -2
  33. package/out/parser/semantic/utils.d.ts +0 -1
  34. package/out/parser/semantic/utils.js +0 -2
  35. package/out/parser/semantic/validate.d.ts +2 -3
  36. package/out/parser/semantic/validate.js +0 -1
  37. package/out/parser/string/reduce/dynamic.d.ts +0 -1
  38. package/out/parser/string/reduce/dynamic.js +0 -1
  39. package/out/parser/string/reduce/shared.d.ts +5 -18
  40. package/out/parser/string/reduce/shared.js +0 -1
  41. package/out/parser/string/reduce/static.d.ts +0 -1
  42. package/out/parser/string/reduce/static.js +0 -2
  43. package/out/parser/string/shift/operand/date.d.ts +2 -3
  44. package/out/parser/string/shift/operand/date.js +0 -1
  45. package/out/parser/string/shift/operand/enclosed.d.ts +2 -17
  46. package/out/parser/string/shift/operand/enclosed.js +0 -1
  47. package/out/parser/string/shift/operand/genericArgs.d.ts +1 -2
  48. package/out/parser/string/shift/operand/genericArgs.js +0 -1
  49. package/out/parser/string/shift/operand/operand.d.ts +0 -1
  50. package/out/parser/string/shift/operand/operand.js +0 -1
  51. package/out/parser/string/shift/operand/unenclosed.d.ts +2 -3
  52. package/out/parser/string/shift/operand/unenclosed.js +1 -3
  53. package/out/parser/string/shift/operand/unenclosed.js.map +1 -1
  54. package/out/parser/string/shift/operator/bounds.d.ts +1 -8
  55. package/out/parser/string/shift/operator/bounds.js +0 -1
  56. package/out/parser/string/shift/operator/divisor.d.ts +1 -2
  57. package/out/parser/string/shift/operator/divisor.js +0 -1
  58. package/out/parser/string/shift/operator/operator.d.ts +1 -2
  59. package/out/parser/string/shift/operator/operator.js +0 -1
  60. package/out/parser/string/shift/scanner.d.ts +0 -1
  61. package/out/parser/string/shift/scanner.js +0 -1
  62. package/out/parser/string/string.d.ts +0 -1
  63. package/out/parser/string/string.js +0 -1
  64. package/out/parser/tuple.d.ts +1 -2
  65. package/out/parser/tuple.js +0 -1
  66. package/out/scope.d.ts +6 -6
  67. package/out/scope.js +6 -6
  68. package/out/scope.js.map +1 -1
  69. package/out/type.d.ts +0 -1
  70. package/out/type.js +0 -1
  71. package/out/type.js.map +1 -1
  72. package/package.json +6 -4
  73. package/parser/generic.ts +2 -2
  74. package/parser/objectLiteral.ts +23 -7
  75. package/parser/string/shift/operand/unenclosed.ts +1 -2
  76. package/scope.ts +18 -12
  77. package/type.ts +1 -0
  78. package/__tests__/cyclic.test.ts +0 -148
  79. package/out/ark.d.ts.map +0 -1
  80. package/out/base.d.ts +0 -205
  81. package/out/base.d.ts.map +0 -1
  82. package/out/base.js +0 -320
  83. package/out/base.js.map +0 -1
  84. package/out/builtins/builtins.d.ts +0 -23
  85. package/out/builtins/builtins.d.ts.map +0 -1
  86. package/out/builtins/builtins.js +0 -15
  87. package/out/builtins/builtins.js.map +0 -1
  88. package/out/builtins/jsObjects.d.ts +0 -19
  89. package/out/builtins/jsObjects.d.ts.map +0 -1
  90. package/out/builtins/jsObjects.js +0 -18
  91. package/out/builtins/jsObjects.js.map +0 -1
  92. package/out/builtins/parsing.d.ts +0 -16
  93. package/out/builtins/parsing.d.ts.map +0 -1
  94. package/out/builtins/parsing.js +0 -62
  95. package/out/builtins/parsing.js.map +0 -1
  96. package/out/builtins/tsGenerics.d.ts +0 -2
  97. package/out/builtins/tsGenerics.d.ts.map +0 -1
  98. package/out/builtins/tsGenerics.js +0 -26
  99. package/out/builtins/tsGenerics.js.map +0 -1
  100. package/out/builtins/tsKeywords.d.ts +0 -23
  101. package/out/builtins/tsKeywords.d.ts.map +0 -1
  102. package/out/builtins/tsKeywords.js +0 -23
  103. package/out/builtins/tsKeywords.js.map +0 -1
  104. package/out/builtins/utils/creditCard.d.ts +0 -3
  105. package/out/builtins/utils/creditCard.d.ts.map +0 -1
  106. package/out/builtins/utils/creditCard.js +0 -35
  107. package/out/builtins/utils/creditCard.js.map +0 -1
  108. package/out/builtins/utils/date.d.ts +0 -41
  109. package/out/builtins/utils/date.d.ts.map +0 -1
  110. package/out/builtins/utils/date.js +0 -56
  111. package/out/builtins/utils/date.js.map +0 -1
  112. package/out/builtins/validation.d.ts +0 -19
  113. package/out/builtins/validation.d.ts.map +0 -1
  114. package/out/builtins/validation.js +0 -74
  115. package/out/builtins/validation.js.map +0 -1
  116. package/out/config.d.ts +0 -9
  117. package/out/config.d.ts.map +0 -1
  118. package/out/config.js +0 -18
  119. package/out/config.js.map +0 -1
  120. package/out/constraints/ast.d.ts +0 -287
  121. package/out/constraints/ast.d.ts.map +0 -1
  122. package/out/constraints/ast.js +0 -2
  123. package/out/constraints/ast.js.map +0 -1
  124. package/out/constraints/constraint.d.ts +0 -200
  125. package/out/constraints/constraint.d.ts.map +0 -1
  126. package/out/constraints/constraint.js +0 -25
  127. package/out/constraints/constraint.js.map +0 -1
  128. package/out/constraints/predicate.d.ts +0 -64
  129. package/out/constraints/predicate.d.ts.map +0 -1
  130. package/out/constraints/predicate.js +0 -52
  131. package/out/constraints/predicate.js.map +0 -1
  132. package/out/constraints/props/index.d.ts +0 -42
  133. package/out/constraints/props/index.d.ts.map +0 -1
  134. package/out/constraints/props/index.js +0 -56
  135. package/out/constraints/props/index.js.map +0 -1
  136. package/out/constraints/props/optional.d.ts +0 -37
  137. package/out/constraints/props/optional.d.ts.map +0 -1
  138. package/out/constraints/props/optional.js +0 -56
  139. package/out/constraints/props/optional.js.map +0 -1
  140. package/out/constraints/props/prop.d.ts +0 -49
  141. package/out/constraints/props/prop.d.ts.map +0 -1
  142. package/out/constraints/props/prop.js +0 -106
  143. package/out/constraints/props/prop.js.map +0 -1
  144. package/out/constraints/props/props.d.ts +0 -37
  145. package/out/constraints/props/props.d.ts.map +0 -1
  146. package/out/constraints/props/props.js +0 -121
  147. package/out/constraints/props/props.js.map +0 -1
  148. package/out/constraints/props/required.d.ts +0 -46
  149. package/out/constraints/props/required.d.ts.map +0 -1
  150. package/out/constraints/props/required.js +0 -81
  151. package/out/constraints/props/required.js.map +0 -1
  152. package/out/constraints/props/sequence.d.ts +0 -82
  153. package/out/constraints/props/sequence.d.ts.map +0 -1
  154. package/out/constraints/props/sequence.js +0 -376
  155. package/out/constraints/props/sequence.js.map +0 -1
  156. package/out/constraints/props/shared.d.ts +0 -3
  157. package/out/constraints/props/shared.d.ts.map +0 -1
  158. package/out/constraints/props/shared.js +0 -4
  159. package/out/constraints/props/shared.js.map +0 -1
  160. package/out/constraints/refinements/after.d.ts +0 -33
  161. package/out/constraints/refinements/after.d.ts.map +0 -1
  162. package/out/constraints/refinements/after.js +0 -36
  163. package/out/constraints/refinements/after.js.map +0 -1
  164. package/out/constraints/refinements/before.d.ts +0 -33
  165. package/out/constraints/refinements/before.d.ts.map +0 -1
  166. package/out/constraints/refinements/before.js +0 -43
  167. package/out/constraints/refinements/before.js.map +0 -1
  168. package/out/constraints/refinements/divisor.d.ts +0 -52
  169. package/out/constraints/refinements/divisor.d.ts.map +0 -1
  170. package/out/constraints/refinements/divisor.js +0 -52
  171. package/out/constraints/refinements/divisor.js.map +0 -1
  172. package/out/constraints/refinements/exactLength.d.ts +0 -45
  173. package/out/constraints/refinements/exactLength.d.ts.map +0 -1
  174. package/out/constraints/refinements/exactLength.js +0 -52
  175. package/out/constraints/refinements/exactLength.js.map +0 -1
  176. package/out/constraints/refinements/kinds.d.ts +0 -29
  177. package/out/constraints/refinements/kinds.d.ts.map +0 -1
  178. package/out/constraints/refinements/kinds.js +0 -17
  179. package/out/constraints/refinements/kinds.js.map +0 -1
  180. package/out/constraints/refinements/length.d.ts +0 -48
  181. package/out/constraints/refinements/length.d.ts.map +0 -1
  182. package/out/constraints/refinements/length.js +0 -53
  183. package/out/constraints/refinements/length.js.map +0 -1
  184. package/out/constraints/refinements/max.d.ts +0 -31
  185. package/out/constraints/refinements/max.d.ts.map +0 -1
  186. package/out/constraints/refinements/max.js +0 -35
  187. package/out/constraints/refinements/max.js.map +0 -1
  188. package/out/constraints/refinements/maxLength.d.ts +0 -32
  189. package/out/constraints/refinements/maxLength.d.ts.map +0 -1
  190. package/out/constraints/refinements/maxLength.js +0 -36
  191. package/out/constraints/refinements/maxLength.js.map +0 -1
  192. package/out/constraints/refinements/min.d.ts +0 -31
  193. package/out/constraints/refinements/min.d.ts.map +0 -1
  194. package/out/constraints/refinements/min.js +0 -28
  195. package/out/constraints/refinements/min.js.map +0 -1
  196. package/out/constraints/refinements/minLength.d.ts +0 -32
  197. package/out/constraints/refinements/minLength.d.ts.map +0 -1
  198. package/out/constraints/refinements/minLength.js +0 -33
  199. package/out/constraints/refinements/minLength.js.map +0 -1
  200. package/out/constraints/refinements/range.d.ts +0 -119
  201. package/out/constraints/refinements/range.d.ts.map +0 -1
  202. package/out/constraints/refinements/range.js +0 -89
  203. package/out/constraints/refinements/range.js.map +0 -1
  204. package/out/constraints/refinements/regex.d.ts +0 -47
  205. package/out/constraints/refinements/regex.d.ts.map +0 -1
  206. package/out/constraints/refinements/regex.js +0 -37
  207. package/out/constraints/refinements/regex.js.map +0 -1
  208. package/out/constraints/refinements/shared.d.ts +0 -20
  209. package/out/constraints/refinements/shared.d.ts.map +0 -1
  210. package/out/constraints/refinements/shared.js +0 -10
  211. package/out/constraints/refinements/shared.js.map +0 -1
  212. package/out/generic.d.ts.map +0 -1
  213. package/out/inference.d.ts +0 -137
  214. package/out/inference.d.ts.map +0 -1
  215. package/out/inference.js +0 -73
  216. package/out/inference.js.map +0 -1
  217. package/out/keywords/ark.d.ts +0 -70
  218. package/out/keywords/ark.d.ts.map +0 -1
  219. package/out/keywords/ark.js +0 -29
  220. package/out/keywords/ark.js.map +0 -1
  221. package/out/keywords/internal.d.ts +0 -13
  222. package/out/keywords/internal.d.ts.map +0 -1
  223. package/out/keywords/internal.js +0 -13
  224. package/out/keywords/internal.js.map +0 -1
  225. package/out/keywords/jsObject.d.ts +0 -20
  226. package/out/keywords/jsObject.d.ts.map +0 -1
  227. package/out/keywords/jsObject.js +0 -18
  228. package/out/keywords/jsObject.js.map +0 -1
  229. package/out/keywords/parsing.d.ts +0 -17
  230. package/out/keywords/parsing.d.ts.map +0 -1
  231. package/out/keywords/parsing.js +0 -64
  232. package/out/keywords/parsing.js.map +0 -1
  233. package/out/keywords/root.d.ts +0 -7
  234. package/out/keywords/root.d.ts.map +0 -1
  235. package/out/keywords/root.js +0 -4
  236. package/out/keywords/root.js.map +0 -1
  237. package/out/keywords/tsGenerics.d.ts +0 -2
  238. package/out/keywords/tsGenerics.d.ts.map +0 -1
  239. package/out/keywords/tsGenerics.js +0 -26
  240. package/out/keywords/tsGenerics.js.map +0 -1
  241. package/out/keywords/tsPrimitive.d.ts +0 -24
  242. package/out/keywords/tsPrimitive.d.ts.map +0 -1
  243. package/out/keywords/tsPrimitive.js +0 -25
  244. package/out/keywords/tsPrimitive.js.map +0 -1
  245. package/out/keywords/utils/creditCard.d.ts +0 -11
  246. package/out/keywords/utils/creditCard.d.ts.map +0 -1
  247. package/out/keywords/utils/creditCard.js +0 -35
  248. package/out/keywords/utils/creditCard.js.map +0 -1
  249. package/out/keywords/utils/date.d.ts +0 -45
  250. package/out/keywords/utils/date.d.ts.map +0 -1
  251. package/out/keywords/utils/date.js +0 -56
  252. package/out/keywords/utils/date.js.map +0 -1
  253. package/out/keywords/validation.d.ts +0 -20
  254. package/out/keywords/validation.d.ts.map +0 -1
  255. package/out/keywords/validation.js +0 -80
  256. package/out/keywords/validation.js.map +0 -1
  257. package/out/kinds.d.ts +0 -102
  258. package/out/kinds.d.ts.map +0 -1
  259. package/out/kinds.js +0 -29
  260. package/out/kinds.js.map +0 -1
  261. package/out/main.d.ts.map +0 -1
  262. package/out/match.d.ts.map +0 -1
  263. package/out/module.d.ts.map +0 -1
  264. package/out/parse.d.ts +0 -29
  265. package/out/parse.d.ts.map +0 -1
  266. package/out/parse.js +0 -161
  267. package/out/parse.js.map +0 -1
  268. package/out/parser/definition.d.ts.map +0 -1
  269. package/out/parser/generic.d.ts.map +0 -1
  270. package/out/parser/objectLiteral.d.ts.map +0 -1
  271. package/out/parser/semantic/bounds.d.ts.map +0 -1
  272. package/out/parser/semantic/divisor.d.ts.map +0 -1
  273. package/out/parser/semantic/infer.d.ts.map +0 -1
  274. package/out/parser/semantic/utils.d.ts.map +0 -1
  275. package/out/parser/semantic/validate.d.ts.map +0 -1
  276. package/out/parser/string/reduce/dynamic.d.ts.map +0 -1
  277. package/out/parser/string/reduce/shared.d.ts.map +0 -1
  278. package/out/parser/string/reduce/static.d.ts.map +0 -1
  279. package/out/parser/string/shift/operand/date.d.ts.map +0 -1
  280. package/out/parser/string/shift/operand/enclosed.d.ts.map +0 -1
  281. package/out/parser/string/shift/operand/genericArgs.d.ts.map +0 -1
  282. package/out/parser/string/shift/operand/operand.d.ts.map +0 -1
  283. package/out/parser/string/shift/operand/unenclosed.d.ts.map +0 -1
  284. package/out/parser/string/shift/operator/bounds.d.ts.map +0 -1
  285. package/out/parser/string/shift/operator/divisor.d.ts.map +0 -1
  286. package/out/parser/string/shift/operator/operator.d.ts.map +0 -1
  287. package/out/parser/string/shift/scanner.d.ts.map +0 -1
  288. package/out/parser/string/string.d.ts.map +0 -1
  289. package/out/parser/tuple.d.ts.map +0 -1
  290. package/out/schema.d.ts +0 -175
  291. package/out/schema.d.ts.map +0 -1
  292. package/out/schema.js +0 -73
  293. package/out/schema.js.map +0 -1
  294. package/out/schemaScope.d.ts +0 -180
  295. package/out/schemaScope.d.ts.map +0 -1
  296. package/out/schemaScope.js +0 -235
  297. package/out/schemaScope.js.map +0 -1
  298. package/out/scope.d.ts.map +0 -1
  299. package/out/shared/compile.d.ts +0 -22
  300. package/out/shared/compile.d.ts.map +0 -1
  301. package/out/shared/compile.js +0 -79
  302. package/out/shared/compile.js.map +0 -1
  303. package/out/shared/context.d.ts +0 -54
  304. package/out/shared/context.d.ts.map +0 -1
  305. package/out/shared/context.js +0 -53
  306. package/out/shared/context.js.map +0 -1
  307. package/out/shared/declare.d.ts +0 -69
  308. package/out/shared/declare.d.ts.map +0 -1
  309. package/out/shared/declare.js +0 -2
  310. package/out/shared/declare.js.map +0 -1
  311. package/out/shared/disjoint.d.ts +0 -91
  312. package/out/shared/disjoint.d.ts.map +0 -1
  313. package/out/shared/disjoint.js +0 -110
  314. package/out/shared/disjoint.js.map +0 -1
  315. package/out/shared/errors.d.ts +0 -99
  316. package/out/shared/errors.d.ts.map +0 -1
  317. package/out/shared/errors.js +0 -108
  318. package/out/shared/errors.js.map +0 -1
  319. package/out/shared/implement.d.ts +0 -363
  320. package/out/shared/implement.d.ts.map +0 -1
  321. package/out/shared/implement.js +0 -68
  322. package/out/shared/implement.js.map +0 -1
  323. package/out/shared/inference.d.ts +0 -6
  324. package/out/shared/inference.d.ts.map +0 -1
  325. package/out/shared/inference.js +0 -5
  326. package/out/shared/inference.js.map +0 -1
  327. package/out/shared/intersections.d.ts +0 -60
  328. package/out/shared/intersections.d.ts.map +0 -1
  329. package/out/shared/intersections.js +0 -2
  330. package/out/shared/intersections.js.map +0 -1
  331. package/out/shared/traversal.d.ts +0 -62
  332. package/out/shared/traversal.d.ts.map +0 -1
  333. package/out/shared/traversal.js +0 -97
  334. package/out/shared/traversal.js.map +0 -1
  335. package/out/shared/utils.d.ts +0 -24
  336. package/out/shared/utils.d.ts.map +0 -1
  337. package/out/shared/utils.js +0 -15
  338. package/out/shared/utils.js.map +0 -1
  339. package/out/type.d.ts.map +0 -1
  340. package/out/types/basis.d.ts +0 -47
  341. package/out/types/basis.d.ts.map +0 -1
  342. package/out/types/basis.js +0 -15
  343. package/out/types/basis.js.map +0 -1
  344. package/out/types/discriminate.d.ts +0 -34
  345. package/out/types/discriminate.d.ts.map +0 -1
  346. package/out/types/discriminate.js +0 -120
  347. package/out/types/discriminate.js.map +0 -1
  348. package/out/types/domain.d.ts +0 -57
  349. package/out/types/domain.d.ts.map +0 -1
  350. package/out/types/domain.js +0 -41
  351. package/out/types/domain.js.map +0 -1
  352. package/out/types/intersection.d.ts +0 -127
  353. package/out/types/intersection.d.ts.map +0 -1
  354. package/out/types/intersection.js +0 -379
  355. package/out/types/intersection.js.map +0 -1
  356. package/out/types/morph.d.ts +0 -157
  357. package/out/types/morph.d.ts.map +0 -1
  358. package/out/types/morph.js +0 -99
  359. package/out/types/morph.js.map +0 -1
  360. package/out/types/proto.d.ts +0 -51
  361. package/out/types/proto.d.ts.map +0 -1
  362. package/out/types/proto.js +0 -60
  363. package/out/types/proto.js.map +0 -1
  364. package/out/types/type.d.ts +0 -143
  365. package/out/types/type.d.ts.map +0 -1
  366. package/out/types/type.js +0 -123
  367. package/out/types/type.js.map +0 -1
  368. package/out/types/union.d.ts +0 -71
  369. package/out/types/union.d.ts.map +0 -1
  370. package/out/types/union.js +0 -379
  371. package/out/types/union.js.map +0 -1
  372. package/out/types/unit.d.ts +0 -45
  373. package/out/types/unit.d.ts.map +0 -1
  374. package/out/types/unit.js +0 -56
  375. package/out/types/unit.js.map +0 -1
  376. package/out/util.d.ts +0 -31
  377. package/out/util.d.ts.map +0 -1
  378. package/out/util.js +0 -8
  379. package/out/util.js.map +0 -1
@@ -1,127 +0,0 @@
1
- import { type evaluate, type listable } from "@arktype/util"
2
- import { type Node } from "../base.js"
3
- import {
4
- PropsGroup,
5
- type ExtraneousKeyBehavior,
6
- type ExtraneousKeyRestriction
7
- } from "../constraints/props/props.js"
8
- import type { Inner, Prerequisite, Schema } from "../kinds.js"
9
- import type { NodeCompiler } from "../shared/compile.js"
10
- import { type BaseMeta, type declareNode } from "../shared/declare.js"
11
- import type { ArkTypeError } from "../shared/errors.js"
12
- import {
13
- type ConstraintKind,
14
- type IntersectionChildKind,
15
- type OpenNodeKind,
16
- type nodeImplementationOf
17
- } from "../shared/implement.js"
18
- import type { TraverseAllows, TraverseApply } from "../shared/traversal.js"
19
- import type { DomainNode, DomainSchema } from "./domain.js"
20
- import type { ProtoNode, ProtoSchema } from "./proto.js"
21
- import { BaseType, type Type } from "./type.js"
22
- export type IntersectionBasisKind = "domain" | "proto"
23
- export type IntersectionInner = evaluate<
24
- BaseMeta & {
25
- domain?: DomainNode
26
- proto?: ProtoNode
27
- } & {
28
- [k in ConditionalIntersectionKey]?: conditionalInnerValueOfKey<k>
29
- }
30
- >
31
- export type IntersectionSchema<inferredBasis = any> = evaluate<
32
- BaseMeta & {
33
- domain?: DomainSchema
34
- proto?: ProtoSchema
35
- } & conditionalSchemaOf<inferredBasis>
36
- >
37
- export type IntersectionDeclaration = declareNode<{
38
- kind: "intersection"
39
- schema: IntersectionSchema
40
- normalizedSchema: IntersectionSchema
41
- inner: IntersectionInner
42
- reducibleTo: "intersection" | IntersectionBasisKind
43
- errorContext: {
44
- errors: readonly ArkTypeError[]
45
- }
46
- childKind: IntersectionChildKind
47
- }>
48
- export declare class IntersectionNode<t = unknown, $ = any> extends BaseType<
49
- t,
50
- IntersectionDeclaration,
51
- $
52
- > {
53
- static implementation: nodeImplementationOf<IntersectionDeclaration>
54
- readonly basis: ProtoNode<any, any> | DomainNode<any, any> | undefined
55
- readonly refinements: Node<
56
- | "regex"
57
- | "divisor"
58
- | "exactLength"
59
- | "max"
60
- | "min"
61
- | "maxLength"
62
- | "minLength"
63
- | "before"
64
- | "after"
65
- >[]
66
- readonly props: PropsGroup | undefined
67
- readonly traversables: readonly (
68
- | PropsGroup
69
- | Node<
70
- | "proto"
71
- | "domain"
72
- | "regex"
73
- | "divisor"
74
- | "exactLength"
75
- | "max"
76
- | "min"
77
- | "maxLength"
78
- | "minLength"
79
- | "before"
80
- | "after"
81
- | "predicate"
82
- >
83
- )[]
84
- readonly expression: string
85
- traverseAllows: TraverseAllows
86
- traverseApply: TraverseApply
87
- compile(js: NodeCompiler): void
88
- rawKeyOf(): Type
89
- }
90
- export type ConditionalTerminalIntersectionSchema = {
91
- onExtraneousKey?: ExtraneousKeyBehavior
92
- }
93
- export type ConditionalTerminalIntersectionInner = {
94
- onExtraneousKey?: ExtraneousKeyRestriction
95
- }
96
- type ConditionalTerminalIntersectionKey =
97
- keyof ConditionalTerminalIntersectionInner
98
- type ConditionalIntersectionKey =
99
- | ConstraintKind
100
- | keyof ConditionalTerminalIntersectionInner
101
- export type constraintKindOf<t> = {
102
- [k in ConstraintKind]: t extends Prerequisite<k> ? k : never
103
- }[ConstraintKind]
104
- type conditionalIntersectionKeyOf<t> =
105
- | constraintKindOf<t>
106
- | (t extends object ? "onExtraneousKey" : never)
107
- type intersectionChildSchemaValueOf<k extends IntersectionChildKind> =
108
- k extends OpenNodeKind
109
- ? listable<Schema<k> | Inner<k>>
110
- : Schema<k> | Inner<k>
111
- type conditionalSchemaValueOfKey<k extends ConditionalIntersectionKey> =
112
- k extends IntersectionChildKind
113
- ? intersectionChildSchemaValueOf<k>
114
- : ConditionalTerminalIntersectionSchema[k &
115
- ConditionalTerminalIntersectionKey]
116
- type intersectionChildInnerValueOf<k extends IntersectionChildKind> =
117
- k extends OpenNodeKind ? readonly Node<k>[] : Node<k>
118
- type conditionalInnerValueOfKey<k extends ConditionalIntersectionKey> =
119
- k extends IntersectionChildKind
120
- ? intersectionChildInnerValueOf<k>
121
- : ConditionalTerminalIntersectionInner[k &
122
- ConditionalTerminalIntersectionKey]
123
- export type conditionalSchemaOf<t> = {
124
- [k in conditionalIntersectionKeyOf<t>]?: conditionalSchemaValueOfKey<k>
125
- }
126
- export {}
127
- //# sourceMappingURL=intersection.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"intersection.d.ts","sourceRoot":"","sources":["../../types/intersection.ts"],"names":[],"mappings":"AAAA,OAAO,EAYN,KAAK,QAAQ,EACb,KAAK,QAAQ,EACb,MAAM,eAAe,CAAA;AACtB,OAAO,EAAiC,KAAK,IAAI,EAAE,MAAM,YAAY,CAAA;AACrE,OAAO,EACN,UAAU,EACV,KAAK,qBAAqB,EAC1B,KAAK,wBAAwB,EAC7B,MAAM,+BAA+B,CAAA;AACtC,OAAO,KAAK,EAAE,KAAK,EAAgB,YAAY,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAG5E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AACxD,OAAO,EAAY,KAAK,QAAQ,EAAE,KAAK,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAEhF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AACvD,OAAO,EAGN,KAAK,cAAc,EACnB,KAAK,qBAAqB,EAC1B,KAAK,YAAY,EAGjB,KAAK,oBAAoB,EACzB,MAAM,wBAAwB,CAAA;AAC/B,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAA;AAC3E,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,aAAa,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CAAC,CAAC,SAAS,qBAAqB,IACjE,CAAC,SAAS,YAAY,GAAG,SAAS,IAAI,CAAC,CAAC,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA;AAEtD,KAAK,0BAA0B,CAAC,CAAC,SAAS,0BAA0B,IACnE,CAAC,SAAS,qBAAqB,GAC5B,6BAA6B,CAAC,CAAC,CAAC,GAChC,oCAAoC,CAAC,CAAC,GACtC,kCAAkC,CAAC,CAAA;AAEvC,MAAM,MAAM,mBAAmB,CAAC,CAAC,IAAI;KACnC,CAAC,IAAI,4BAA4B,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,2BAA2B,CAAC,CAAC,CAAC;CACvE,CAAA"}
@@ -1,379 +0,0 @@
1
- import {
2
- append,
3
- appendUnique,
4
- conflatenateAll,
5
- entriesOf,
6
- isArray,
7
- isEmptyObject,
8
- omit,
9
- pick,
10
- splitByKeys,
11
- throwInternalError
12
- } from "@arktype/util"
13
- import { BaseNode } from "../base.js"
14
- import { PropsGroup } from "../constraints/props/props.js"
15
- import { metaKeys } from "../shared/declare.js"
16
- import { Disjoint } from "../shared/disjoint.js"
17
- import { constraintKeys, propKeys } from "../shared/implement.js"
18
- import { BaseType, defineRightwardIntersections } from "./type.js"
19
- const intersectionChildKeyParser = (kind) => (input, ctx) => {
20
- if (isArray(input)) {
21
- if (input.length === 0) {
22
- // Omit empty lists as input
23
- return
24
- }
25
- return input
26
- .map((schema) => ctx.$.node(kind, schema))
27
- .sort((l, r) => (l.innerId < r.innerId ? -1 : 1))
28
- }
29
- const node = ctx.$.node(kind, input)
30
- return node.intersectionIsOpen ? [node] : node
31
- }
32
- // readonly literalKeys = this.named.map((prop) => prop.key.name)
33
- // readonly namedKeyOf = cached(() => node.unit(...this.literalKeys))
34
- // readonly indexedKeyOf = cached(
35
- // () =>
36
- // new Type(
37
- // this.indexed.flatMap((entry) => entry.key.branches),
38
- // this.meta
39
- // )
40
- // )
41
- // readonly keyof = cached(() => this.namedKeyOf().or(this.indexedKeyOf()))
42
- // get(key: string | Type) {
43
- // return typeof key === "string"
44
- // ? this.named.find((entry) => entry.value.branches)?.value
45
- // : this.indexed.find((entry) => entry.key.equals(key))?.value
46
- // }
47
- const intersectIntersections = (reduced, raw, $) => {
48
- // avoid treating adding instance keys as keys of lRoot, rRoot
49
- if (reduced instanceof IntersectionNode) reduced = reduced.inner
50
- if (raw instanceof IntersectionNode) raw = raw.inner
51
- const [reducedConstraintsInner, reducedRoot] = splitByKeys(
52
- reduced,
53
- constraintKeys
54
- )
55
- const [rawConstraintsInner, rawRoot] = splitByKeys(raw, constraintKeys)
56
- // since intersection with a left operand of unknown is leveraged for
57
- // reduction, check for the case where r is empty so we can preserve
58
- // metadata and save some time
59
- const root = isEmptyObject(reduced)
60
- ? rawRoot
61
- : intersectRootKeys(reducedRoot, rawRoot)
62
- if (root instanceof Disjoint) return root
63
- const lConstraints = flattenConstraints(reducedConstraintsInner)
64
- const rConstraints = flattenConstraints(rawConstraintsInner)
65
- return intersectConstraints({
66
- root,
67
- l: lConstraints,
68
- r: rConstraints,
69
- types: [],
70
- $
71
- })
72
- }
73
- export class IntersectionNode extends BaseType {
74
- static implementation = this.implement({
75
- hasAssociatedError: true,
76
- normalize: (schema) => schema,
77
- keys: {
78
- domain: {
79
- child: true,
80
- parse: intersectionChildKeyParser("domain")
81
- },
82
- proto: {
83
- child: true,
84
- parse: intersectionChildKeyParser("proto")
85
- },
86
- divisor: {
87
- child: true,
88
- parse: intersectionChildKeyParser("divisor")
89
- },
90
- max: {
91
- child: true,
92
- parse: intersectionChildKeyParser("max")
93
- },
94
- min: {
95
- child: true,
96
- parse: intersectionChildKeyParser("min")
97
- },
98
- maxLength: {
99
- child: true,
100
- parse: intersectionChildKeyParser("maxLength")
101
- },
102
- minLength: {
103
- child: true,
104
- parse: intersectionChildKeyParser("minLength")
105
- },
106
- exactLength: {
107
- child: true,
108
- parse: intersectionChildKeyParser("exactLength")
109
- },
110
- before: {
111
- child: true,
112
- parse: intersectionChildKeyParser("before")
113
- },
114
- after: {
115
- child: true,
116
- parse: intersectionChildKeyParser("after")
117
- },
118
- regex: {
119
- child: true,
120
- parse: intersectionChildKeyParser("regex")
121
- },
122
- predicate: {
123
- child: true,
124
- parse: intersectionChildKeyParser("predicate")
125
- },
126
- prop: {
127
- child: true,
128
- parse: intersectionChildKeyParser("prop")
129
- },
130
- index: {
131
- child: true,
132
- parse: intersectionChildKeyParser("index")
133
- },
134
- sequence: {
135
- child: true,
136
- parse: intersectionChildKeyParser("sequence")
137
- },
138
- onExtraneousKey: {
139
- parse: (def) => (def === "ignore" ? undefined : def)
140
- }
141
- },
142
- // leverage reduction logic from intersection and identity to ensure initial
143
- // parse result is reduced
144
- reduce: (inner, $) =>
145
- // we cast union out of the result here since that only occurs when intersecting two sequences
146
- // that cannot occur when reducing a single intersection schema using unknown
147
- intersectIntersections({}, inner, $),
148
- defaults: {
149
- description(node) {
150
- return node.children.length === 0
151
- ? "unknown"
152
- : node.props?.description ??
153
- node.children
154
- .map((child) => child.description)
155
- .join(" and ")
156
- },
157
- expected(source) {
158
- return (
159
- " • " + source.errors.map((e) => e.expected).join("\n • ")
160
- )
161
- },
162
- problem(ctx) {
163
- return `must be...\n${ctx.expected}`
164
- }
165
- },
166
- intersections: {
167
- intersection: intersectIntersections,
168
- ...defineRightwardIntersections("intersection", (l, r, $) => {
169
- // if l is unknown, return r
170
- if (l.children.length === 0) return r
171
- const basis = l.basis?.intersect(r) ?? r
172
- return basis instanceof Disjoint
173
- ? basis
174
- : l?.basis?.equals(basis)
175
- ? // if the basis doesn't change, return the original intesection
176
- l
177
- : // given we've already precluded l being unknown, the result must
178
- // be an intersection with the new basis result integrated
179
- $.node(
180
- "intersection",
181
- Object.assign(omit(l.inner, metaKeys), {
182
- [basis.kind]: basis
183
- }),
184
- { prereduced: true }
185
- )
186
- })
187
- }
188
- })
189
- basis = this.domain ?? this.proto
190
- refinements = this.children.filter((node) => node.isRefinement())
191
- props = maybeCreatePropsGroup(this.inner, this.$)
192
- traversables = conflatenateAll(
193
- this.basis,
194
- this.refinements,
195
- this.props,
196
- this.predicate
197
- )
198
- expression =
199
- this.props?.expression ||
200
- this.children.map((node) => node.nestableExpression).join(" & ") ||
201
- "unknown"
202
- traverseAllows = (data, ctx) =>
203
- this.traversables.every((traversable) =>
204
- traversable.traverseAllows(data, ctx)
205
- )
206
- traverseApply = (data, ctx) => {
207
- if (this.basis) {
208
- this.basis.traverseApply(data, ctx)
209
- if (ctx.hasError()) return
210
- }
211
- if (this.refinements.length) {
212
- for (let i = 0; i < this.refinements.length - 1; i++) {
213
- this.refinements[i].traverseApply(data, ctx)
214
- if (ctx.failFast && ctx.hasError()) return
215
- }
216
- this.refinements.at(-1).traverseApply(data, ctx)
217
- if (ctx.hasError()) return
218
- }
219
- if (this.props) {
220
- this.props.traverseApply(data, ctx)
221
- if (ctx.hasError()) return
222
- }
223
- if (this.predicate) {
224
- for (let i = 0; i < this.predicate.length - 1; i++) {
225
- this.predicate[i].traverseApply(data, ctx)
226
- if (ctx.failFast && ctx.hasError()) return
227
- }
228
- this.predicate.at(-1).traverseApply(data, ctx)
229
- }
230
- }
231
- compile(js) {
232
- if (js.traversalKind === "Allows") {
233
- this.traversables.forEach((traversable) =>
234
- traversable instanceof BaseNode
235
- ? js.check(traversable)
236
- : traversable.compile(js)
237
- )
238
- js.return(true)
239
- return
240
- }
241
- const returnIfFail = () => js.if("ctx.hasError()", () => js.return())
242
- const returnIfFailFast = () =>
243
- js.if("ctx.failFast && ctx.hasError()", () => js.return())
244
- if (this.basis) {
245
- js.check(this.basis)
246
- // we only have to return conditionally if this is not the last check
247
- if (this.traversables.length > 1) returnIfFail()
248
- }
249
- if (this.refinements.length) {
250
- for (let i = 0; i < this.refinements.length - 1; i++) {
251
- js.check(this.refinements[i])
252
- returnIfFailFast()
253
- }
254
- js.check(this.refinements.at(-1))
255
- if (this.props || this.predicate) returnIfFail()
256
- }
257
- if (this.props) {
258
- this.props.compile(js)
259
- if (this.predicate) returnIfFail()
260
- }
261
- if (this.predicate) {
262
- for (let i = 0; i < this.predicate.length - 1; i++) {
263
- js.check(this.predicate[i])
264
- // since predicates can be chained, we have to fail immediately
265
- // if one fails
266
- returnIfFail()
267
- }
268
- js.check(this.predicate.at(-1))
269
- }
270
- }
271
- rawKeyOf() {
272
- return this.basis
273
- ? this.props
274
- ? this.basis.rawKeyOf().or(this.props.rawKeyOf())
275
- : this.basis.rawKeyOf()
276
- : this.props?.rawKeyOf() ?? this.$.keywords.never
277
- }
278
- }
279
- const maybeCreatePropsGroup = (inner, $) => {
280
- const propsInput = pick(inner, propKeys)
281
- return isEmptyObject(propsInput) ? undefined : new PropsGroup(propsInput, $)
282
- }
283
- const intersectRootKeys = (l, r) => {
284
- const result = {}
285
- const lBasis = l.proto ?? l.domain
286
- const rBasis = r.proto ?? r.domain
287
- const resultBasis = lBasis
288
- ? rBasis
289
- ? lBasis.intersect(rBasis)
290
- : lBasis
291
- : rBasis
292
- if (resultBasis) {
293
- if (resultBasis instanceof Disjoint) {
294
- return resultBasis
295
- }
296
- if (resultBasis.kind === "domain" || resultBasis.kind === "proto") {
297
- result[resultBasis.kind] = resultBasis
298
- } else {
299
- return throwInternalError(
300
- `Unexpected intersection basis intersection ${resultBasis}`
301
- )
302
- }
303
- }
304
- if (l.onExtraneousKey || r.onExtraneousKey) {
305
- result.onExtraneousKey =
306
- l.onExtraneousKey === "throw" || r.onExtraneousKey === "throw"
307
- ? "throw"
308
- : "prune"
309
- }
310
- return result
311
- }
312
- const intersectConstraints = (s) => {
313
- if (!s.r.length) {
314
- let result = s.$.node(
315
- "intersection",
316
- Object.assign(s.root, unflattenConstraints(s.l)),
317
- { prereduced: true }
318
- )
319
- for (const type of s.types) {
320
- if (result instanceof Disjoint) {
321
- return result
322
- }
323
- result = type.intersect(result)
324
- }
325
- return result
326
- }
327
- const head = s.r.shift()
328
- let matched = false
329
- for (let i = 0; i < s.l.length; i++) {
330
- const result = s.l[i].intersect(head)
331
- if (result === null) continue
332
- if (result instanceof Disjoint) return result
333
- if (!matched) {
334
- if (result.isType()) s.types.push(result)
335
- else s.l[i] = result
336
- matched = true
337
- } else if (!s.l.includes(result)) {
338
- return throwInternalError(
339
- `Unexpectedly encountered multiple distinct intersection results for refinement ${result}`
340
- )
341
- }
342
- }
343
- if (!matched) {
344
- s.l.push(head)
345
- }
346
- head.impliedSiblings?.forEach((node) => appendUnique(s.r, node))
347
- return intersectConstraints(s)
348
- }
349
- const flattenConstraints = (inner) => {
350
- const result = entriesOf(inner)
351
- .flatMap(([k, v]) => (k in constraintKeys ? v : []))
352
- .sort((l, r) =>
353
- l.precedence < r.precedence
354
- ? -1
355
- : l.precedence > r.precedence
356
- ? 1
357
- : l.innerId < r.innerId
358
- ? -1
359
- : 1
360
- )
361
- return result
362
- }
363
- const unflattenConstraints = (constraints) => {
364
- const inner = {}
365
- for (const constraint of constraints) {
366
- if (constraint.intersectionIsOpen) {
367
- inner[constraint.kind] = append(inner[constraint.kind], constraint)
368
- } else {
369
- if (inner[constraint.kind]) {
370
- return throwInternalError(
371
- `Unexpected intersection of closed refinements of kind ${constraint.kind}`
372
- )
373
- }
374
- inner[constraint.kind] = constraint
375
- }
376
- }
377
- return inner
378
- }
379
- //# sourceMappingURL=intersection.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"intersection.js","sourceRoot":"","sources":["../../types/intersection.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,MAAM,EACN,YAAY,EACZ,eAAe,EACf,SAAS,EACT,OAAO,EACP,aAAa,EACb,IAAI,EACJ,IAAI,EACJ,WAAW,EACX,kBAAkB,EAIlB,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,QAAQ,EAAkC,MAAM,YAAY,CAAA;AACrE,OAAO,EACN,UAAU,EAGV,MAAM,+BAA+B,CAAA;AAKtC,OAAO,EAAE,QAAQ,EAAmC,MAAM,sBAAsB,CAAA;AAChF,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAEhD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ACd,EAAE;IACtB,MAAM,KAAK,GAAiC,EAAE,CAAA;IAC9C,KAAK,MAAM,UAAU,IAAI,WAAW,EAAE,CAAC;QACtC,IAAI,UAAU,CAAC,kBAAkB,EAAE,CAAC;YACnC,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,MAAM,CAC9B,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,EACtB,UAAU,CACD,CAAA;QACX,CAAC;aAAM,CAAC;YACP,IAAI,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;gBAC5B,OAAO,kBAAkB,CACxB,yDAAyD,UAAU,CAAC,IAAI,EAAE,CAC1E,CAAA;YACF,CAAC;YACD,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,UAAmB,CAAA;QAC7C,CAAC;IACF,CAAC;IACD,OAAO,KAAK,CAAA;AACb,CAAC,CAAA"}
@@ -1,157 +0,0 @@
1
- import {
2
- type BuiltinObjectKind,
3
- type BuiltinObjects,
4
- type Primitive,
5
- type array,
6
- type listable
7
- } from "@arktype/util"
8
- import type { Node } from "../base.js"
9
- import type { of } from "../constraints/ast.js"
10
- import type { Schema } from "../kinds.js"
11
- import type { StaticArkOption } from "../scope.js"
12
- import type { NodeCompiler } from "../shared/compile.js"
13
- import type { BaseMeta, declareNode } from "../shared/declare.js"
14
- import type { ArkResult, ArkTypeError } from "../shared/errors.js"
15
- import { type nodeImplementationOf } from "../shared/implement.js"
16
- import type {
17
- TraversalContext,
18
- TraverseAllows,
19
- TraverseApply
20
- } from "../shared/traversal.js"
21
- import { BaseType, type Type, type typeKindRightOf } from "./type.js"
22
- export type MorphChildKind = typeKindRightOf<"morph">
23
- export declare const morphChildKinds: readonly [
24
- "intersection",
25
- "unit",
26
- "proto",
27
- "domain"
28
- ]
29
- export type MorphChildNode = Node<MorphChildKind>
30
- export type MorphChildDefinition = Schema<MorphChildKind>
31
- export type Morph<i = any, o = unknown> = (In: i, ctx: TraversalContext) => o
32
- export type Out<o = any> = ["=>", o]
33
- export type MorphAst<i = any, o = any> = (In: i) => Out<o>
34
- export interface MorphInner extends BaseMeta {
35
- readonly in: MorphChildNode
36
- readonly out: MorphChildNode
37
- readonly morphs: readonly Morph[]
38
- }
39
- export interface MorphSchema extends BaseMeta {
40
- readonly in: MorphChildDefinition
41
- readonly out?: MorphChildDefinition
42
- readonly morphs: listable<Morph>
43
- }
44
- export type MorphDeclaration = declareNode<{
45
- kind: "morph"
46
- schema: MorphSchema
47
- normalizedSchema: MorphSchema
48
- inner: MorphInner
49
- childKind: MorphChildKind
50
- }>
51
- export declare class MorphNode<t = any, $ = any> extends BaseType<
52
- t,
53
- MorphDeclaration,
54
- $
55
- > {
56
- static implementation: nodeImplementationOf<MorphDeclaration>
57
- readonly expression: string
58
- readonly serializedMorphs: `$ark.${string}`[]
59
- traverseAllows: TraverseAllows
60
- traverseApply: TraverseApply
61
- compile(js: NodeCompiler): void
62
- get in(): Node<MorphChildKind, distillConstrainableIn<t>>
63
- get out(): Node<MorphChildKind, distillConstrainableOut<t>>
64
- rawKeyOf(): Type
65
- }
66
- export type inferMorphOut<out> = out extends ArkResult<unknown, infer innerOut>
67
- ? out extends null
68
- ? out
69
- : innerOut
70
- : Exclude<out, ArkTypeError>
71
- export type distillIn<t> = includesMorphs<t> extends true
72
- ? distillRecurse<t, "in", "base">
73
- : t
74
- export type distillOut<t> = includesMorphs<t> extends true
75
- ? distillRecurse<t, "out", "base">
76
- : t
77
- export type distillConstrainableIn<t> = includesMorphs<t> extends true
78
- ? distillRecurse<t, "in", "constrainable">
79
- : t
80
- export type distillConstrainableOut<t> = includesMorphs<t> extends true
81
- ? distillRecurse<t, "out", "constrainable">
82
- : t
83
- export type includesMorphs<t> = [
84
- t,
85
- distillRecurse<t, "in", "base">,
86
- t,
87
- distillRecurse<t, "out", "base">
88
- ] extends [
89
- distillRecurse<t, "in", "base">,
90
- t,
91
- distillRecurse<t, "out", "base">,
92
- t
93
- ]
94
- ? false
95
- : true
96
- type distillRecurse<
97
- t,
98
- io extends "in" | "out",
99
- distilledKind extends "base" | "constrainable"
100
- > = unknown extends t
101
- ? unknown
102
- : t extends MorphAst<infer i, infer o>
103
- ? io extends "in"
104
- ? i
105
- : o
106
- : t extends of<infer base, any>
107
- ? distilledKind extends "base"
108
- ? distillRecurse<base, io, distilledKind>
109
- : t
110
- : t extends TerminallyInferredObjectKind | Primitive
111
- ? t
112
- : t extends array
113
- ? distillArray<t, io, distilledKind, []>
114
- : {
115
- [k in keyof t]: distillRecurse<
116
- t[k],
117
- io,
118
- distilledKind
119
- >
120
- }
121
- type distillArray<
122
- t extends array,
123
- io extends "in" | "out",
124
- constraints extends "base" | "constrainable",
125
- prefix extends array
126
- > = t extends readonly [infer head, ...infer tail]
127
- ? distillArray<
128
- tail,
129
- io,
130
- constraints,
131
- [...prefix, distillRecurse<head, io, constraints>]
132
- >
133
- : [...prefix, ...distillPostfix<t, io, constraints>]
134
- type distillPostfix<
135
- t extends array,
136
- io extends "in" | "out",
137
- constraints extends "base" | "constrainable",
138
- postfix extends array = []
139
- > = t extends readonly [...infer init, infer last]
140
- ? distillPostfix<
141
- init,
142
- io,
143
- constraints,
144
- [distillRecurse<last, io, constraints>, ...postfix]
145
- >
146
- : [
147
- ...{
148
- [i in keyof t]: distillRecurse<t[i], io, constraints>
149
- },
150
- ...postfix
151
- ]
152
- /** Objects we don't want to expand during inference like Date or Promise */
153
- type TerminallyInferredObjectKind =
154
- | StaticArkOption<"preserve">
155
- | BuiltinObjects[Exclude<BuiltinObjectKind, "Array">]
156
- export {}
157
- //# sourceMappingURL=morph.d.ts.map