arktype 2.0.0-dev.7 → 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 (414) hide show
  1. package/__tests__/array.test.ts +23 -25
  2. package/__tests__/config.test.ts +19 -8
  3. package/__tests__/examples.test.ts +3 -3
  4. package/__tests__/imports.test.ts +18 -12
  5. package/__tests__/instanceof.test.ts +7 -7
  6. package/__tests__/intersection.test.ts +2 -2
  7. package/__tests__/keyTraversal.test.ts +15 -15
  8. package/__tests__/keywords.test.ts +50 -37
  9. package/__tests__/literal.test.ts +30 -14
  10. package/__tests__/match.bench.ts +6 -6
  11. package/__tests__/narrow.test.ts +18 -24
  12. package/__tests__/objectLiteral.test.ts +134 -11
  13. package/__tests__/operator.bench.ts +4 -4
  14. package/__tests__/{morph.test.ts → pipe.test.ts} +136 -75
  15. package/__tests__/scope.test.ts +202 -15
  16. package/__tests__/traverse.test.ts +45 -36
  17. package/__tests__/type.test.ts +8 -10
  18. package/ark.ts +14 -11
  19. package/generic.ts +8 -6
  20. package/match.ts +59 -70
  21. package/out/ark.d.ts +5 -5
  22. package/out/ark.js +4 -5
  23. package/out/ark.js.map +1 -1
  24. package/out/generic.d.ts +0 -1
  25. package/out/generic.js +8 -7
  26. package/out/generic.js.map +1 -1
  27. package/out/main.d.ts +0 -1
  28. package/out/main.js +0 -1
  29. package/out/match.d.ts +0 -1
  30. package/out/match.js +50 -57
  31. package/out/match.js.map +1 -1
  32. package/out/module.d.ts +0 -1
  33. package/out/module.js +0 -1
  34. package/out/parser/definition.d.ts +1 -2
  35. package/out/parser/definition.js +0 -1
  36. package/out/parser/generic.d.ts +5 -6
  37. package/out/parser/generic.js +4 -6
  38. package/out/parser/generic.js.map +1 -1
  39. package/out/parser/objectLiteral.d.ts +1 -2
  40. package/out/parser/objectLiteral.js +17 -11
  41. package/out/parser/objectLiteral.js.map +1 -1
  42. package/out/parser/semantic/bounds.d.ts +1 -2
  43. package/out/parser/semantic/bounds.js +0 -1
  44. package/out/parser/semantic/divisor.d.ts +0 -1
  45. package/out/parser/semantic/divisor.js +0 -2
  46. package/out/parser/semantic/infer.d.ts +0 -1
  47. package/out/parser/semantic/infer.js +0 -2
  48. package/out/parser/semantic/utils.d.ts +0 -1
  49. package/out/parser/semantic/utils.js +0 -2
  50. package/out/parser/semantic/validate.d.ts +4 -5
  51. package/out/parser/semantic/validate.js +0 -1
  52. package/out/parser/semantic/validate.js.map +1 -1
  53. package/out/parser/string/reduce/dynamic.d.ts +0 -1
  54. package/out/parser/string/reduce/dynamic.js +4 -9
  55. package/out/parser/string/reduce/dynamic.js.map +1 -1
  56. package/out/parser/string/reduce/shared.d.ts +5 -18
  57. package/out/parser/string/reduce/shared.js +0 -1
  58. package/out/parser/string/reduce/static.d.ts +0 -1
  59. package/out/parser/string/reduce/static.js +0 -2
  60. package/out/parser/string/shift/operand/date.d.ts +2 -3
  61. package/out/parser/string/shift/operand/date.js +2 -5
  62. package/out/parser/string/shift/operand/date.js.map +1 -1
  63. package/out/parser/string/shift/operand/enclosed.d.ts +2 -17
  64. package/out/parser/string/shift/operand/enclosed.js +6 -9
  65. package/out/parser/string/shift/operand/enclosed.js.map +1 -1
  66. package/out/parser/string/shift/operand/genericArgs.d.ts +5 -6
  67. package/out/parser/string/shift/operand/genericArgs.js +4 -6
  68. package/out/parser/string/shift/operand/genericArgs.js.map +1 -1
  69. package/out/parser/string/shift/operand/operand.d.ts +0 -1
  70. package/out/parser/string/shift/operand/operand.js +0 -1
  71. package/out/parser/string/shift/operand/unenclosed.d.ts +6 -7
  72. package/out/parser/string/shift/operand/unenclosed.js +6 -13
  73. package/out/parser/string/shift/operand/unenclosed.js.map +1 -1
  74. package/out/parser/string/shift/operator/bounds.d.ts +1 -8
  75. package/out/parser/string/shift/operator/bounds.js +4 -9
  76. package/out/parser/string/shift/operator/bounds.js.map +1 -1
  77. package/out/parser/string/shift/operator/divisor.d.ts +1 -2
  78. package/out/parser/string/shift/operator/divisor.js +1 -3
  79. package/out/parser/string/shift/operator/divisor.js.map +1 -1
  80. package/out/parser/string/shift/operator/operator.d.ts +1 -2
  81. package/out/parser/string/shift/operator/operator.js +0 -1
  82. package/out/parser/string/shift/scanner.d.ts +0 -1
  83. package/out/parser/string/shift/scanner.js +2 -5
  84. package/out/parser/string/shift/scanner.js.map +1 -1
  85. package/out/parser/string/string.d.ts +0 -1
  86. package/out/parser/string/string.js +1 -3
  87. package/out/parser/string/string.js.map +1 -1
  88. package/out/parser/tuple.d.ts +1 -2
  89. package/out/parser/tuple.js +12 -16
  90. package/out/parser/tuple.js.map +1 -1
  91. package/out/scope.d.ts +12 -12
  92. package/out/scope.js +16 -38
  93. package/out/scope.js.map +1 -1
  94. package/out/type.d.ts +38 -19
  95. package/out/type.js +32 -2
  96. package/out/type.js.map +1 -1
  97. package/package.json +6 -4
  98. package/parser/generic.ts +13 -14
  99. package/parser/objectLiteral.ts +25 -11
  100. package/parser/semantic/validate.ts +2 -3
  101. package/parser/string/reduce/dynamic.ts +7 -10
  102. package/parser/string/shift/operand/date.ts +3 -6
  103. package/parser/string/shift/operand/enclosed.ts +8 -8
  104. package/parser/string/shift/operand/genericArgs.ts +8 -8
  105. package/parser/string/shift/operand/unenclosed.ts +15 -25
  106. package/parser/string/shift/operator/bounds.ts +7 -9
  107. package/parser/string/shift/operator/divisor.ts +2 -3
  108. package/parser/string/shift/scanner.ts +2 -4
  109. package/parser/string/string.ts +2 -3
  110. package/parser/tuple.ts +15 -16
  111. package/scope.ts +39 -57
  112. package/type.ts +151 -35
  113. package/__tests__/cyclic.test.ts +0 -148
  114. package/out/ark.d.ts.map +0 -1
  115. package/out/base.d.ts +0 -205
  116. package/out/base.d.ts.map +0 -1
  117. package/out/base.js +0 -320
  118. package/out/base.js.map +0 -1
  119. package/out/builtins/builtins.d.ts +0 -23
  120. package/out/builtins/builtins.d.ts.map +0 -1
  121. package/out/builtins/builtins.js +0 -15
  122. package/out/builtins/builtins.js.map +0 -1
  123. package/out/builtins/jsObjects.d.ts +0 -19
  124. package/out/builtins/jsObjects.d.ts.map +0 -1
  125. package/out/builtins/jsObjects.js +0 -18
  126. package/out/builtins/jsObjects.js.map +0 -1
  127. package/out/builtins/parsing.d.ts +0 -16
  128. package/out/builtins/parsing.d.ts.map +0 -1
  129. package/out/builtins/parsing.js +0 -62
  130. package/out/builtins/parsing.js.map +0 -1
  131. package/out/builtins/tsGenerics.d.ts +0 -2
  132. package/out/builtins/tsGenerics.d.ts.map +0 -1
  133. package/out/builtins/tsGenerics.js +0 -26
  134. package/out/builtins/tsGenerics.js.map +0 -1
  135. package/out/builtins/tsKeywords.d.ts +0 -23
  136. package/out/builtins/tsKeywords.d.ts.map +0 -1
  137. package/out/builtins/tsKeywords.js +0 -23
  138. package/out/builtins/tsKeywords.js.map +0 -1
  139. package/out/builtins/utils/creditCard.d.ts +0 -3
  140. package/out/builtins/utils/creditCard.d.ts.map +0 -1
  141. package/out/builtins/utils/creditCard.js +0 -35
  142. package/out/builtins/utils/creditCard.js.map +0 -1
  143. package/out/builtins/utils/date.d.ts +0 -41
  144. package/out/builtins/utils/date.d.ts.map +0 -1
  145. package/out/builtins/utils/date.js +0 -56
  146. package/out/builtins/utils/date.js.map +0 -1
  147. package/out/builtins/validation.d.ts +0 -19
  148. package/out/builtins/validation.d.ts.map +0 -1
  149. package/out/builtins/validation.js +0 -74
  150. package/out/builtins/validation.js.map +0 -1
  151. package/out/config.d.ts +0 -9
  152. package/out/config.d.ts.map +0 -1
  153. package/out/config.js +0 -18
  154. package/out/config.js.map +0 -1
  155. package/out/constraints/ast.d.ts +0 -287
  156. package/out/constraints/ast.d.ts.map +0 -1
  157. package/out/constraints/ast.js +0 -2
  158. package/out/constraints/ast.js.map +0 -1
  159. package/out/constraints/constraint.d.ts +0 -200
  160. package/out/constraints/constraint.d.ts.map +0 -1
  161. package/out/constraints/constraint.js +0 -25
  162. package/out/constraints/constraint.js.map +0 -1
  163. package/out/constraints/predicate.d.ts +0 -64
  164. package/out/constraints/predicate.d.ts.map +0 -1
  165. package/out/constraints/predicate.js +0 -52
  166. package/out/constraints/predicate.js.map +0 -1
  167. package/out/constraints/props/index.d.ts +0 -42
  168. package/out/constraints/props/index.d.ts.map +0 -1
  169. package/out/constraints/props/index.js +0 -56
  170. package/out/constraints/props/index.js.map +0 -1
  171. package/out/constraints/props/optional.d.ts +0 -37
  172. package/out/constraints/props/optional.d.ts.map +0 -1
  173. package/out/constraints/props/optional.js +0 -56
  174. package/out/constraints/props/optional.js.map +0 -1
  175. package/out/constraints/props/prop.d.ts +0 -49
  176. package/out/constraints/props/prop.d.ts.map +0 -1
  177. package/out/constraints/props/prop.js +0 -106
  178. package/out/constraints/props/prop.js.map +0 -1
  179. package/out/constraints/props/props.d.ts +0 -37
  180. package/out/constraints/props/props.d.ts.map +0 -1
  181. package/out/constraints/props/props.js +0 -121
  182. package/out/constraints/props/props.js.map +0 -1
  183. package/out/constraints/props/required.d.ts +0 -46
  184. package/out/constraints/props/required.d.ts.map +0 -1
  185. package/out/constraints/props/required.js +0 -81
  186. package/out/constraints/props/required.js.map +0 -1
  187. package/out/constraints/props/sequence.d.ts +0 -82
  188. package/out/constraints/props/sequence.d.ts.map +0 -1
  189. package/out/constraints/props/sequence.js +0 -376
  190. package/out/constraints/props/sequence.js.map +0 -1
  191. package/out/constraints/props/shared.d.ts +0 -3
  192. package/out/constraints/props/shared.d.ts.map +0 -1
  193. package/out/constraints/props/shared.js +0 -4
  194. package/out/constraints/props/shared.js.map +0 -1
  195. package/out/constraints/refinements/after.d.ts +0 -33
  196. package/out/constraints/refinements/after.d.ts.map +0 -1
  197. package/out/constraints/refinements/after.js +0 -36
  198. package/out/constraints/refinements/after.js.map +0 -1
  199. package/out/constraints/refinements/before.d.ts +0 -33
  200. package/out/constraints/refinements/before.d.ts.map +0 -1
  201. package/out/constraints/refinements/before.js +0 -43
  202. package/out/constraints/refinements/before.js.map +0 -1
  203. package/out/constraints/refinements/divisor.d.ts +0 -52
  204. package/out/constraints/refinements/divisor.d.ts.map +0 -1
  205. package/out/constraints/refinements/divisor.js +0 -52
  206. package/out/constraints/refinements/divisor.js.map +0 -1
  207. package/out/constraints/refinements/exactLength.d.ts +0 -45
  208. package/out/constraints/refinements/exactLength.d.ts.map +0 -1
  209. package/out/constraints/refinements/exactLength.js +0 -52
  210. package/out/constraints/refinements/exactLength.js.map +0 -1
  211. package/out/constraints/refinements/kinds.d.ts +0 -29
  212. package/out/constraints/refinements/kinds.d.ts.map +0 -1
  213. package/out/constraints/refinements/kinds.js +0 -17
  214. package/out/constraints/refinements/kinds.js.map +0 -1
  215. package/out/constraints/refinements/length.d.ts +0 -48
  216. package/out/constraints/refinements/length.d.ts.map +0 -1
  217. package/out/constraints/refinements/length.js +0 -53
  218. package/out/constraints/refinements/length.js.map +0 -1
  219. package/out/constraints/refinements/max.d.ts +0 -31
  220. package/out/constraints/refinements/max.d.ts.map +0 -1
  221. package/out/constraints/refinements/max.js +0 -35
  222. package/out/constraints/refinements/max.js.map +0 -1
  223. package/out/constraints/refinements/maxLength.d.ts +0 -32
  224. package/out/constraints/refinements/maxLength.d.ts.map +0 -1
  225. package/out/constraints/refinements/maxLength.js +0 -36
  226. package/out/constraints/refinements/maxLength.js.map +0 -1
  227. package/out/constraints/refinements/min.d.ts +0 -31
  228. package/out/constraints/refinements/min.d.ts.map +0 -1
  229. package/out/constraints/refinements/min.js +0 -28
  230. package/out/constraints/refinements/min.js.map +0 -1
  231. package/out/constraints/refinements/minLength.d.ts +0 -32
  232. package/out/constraints/refinements/minLength.d.ts.map +0 -1
  233. package/out/constraints/refinements/minLength.js +0 -33
  234. package/out/constraints/refinements/minLength.js.map +0 -1
  235. package/out/constraints/refinements/range.d.ts +0 -119
  236. package/out/constraints/refinements/range.d.ts.map +0 -1
  237. package/out/constraints/refinements/range.js +0 -89
  238. package/out/constraints/refinements/range.js.map +0 -1
  239. package/out/constraints/refinements/regex.d.ts +0 -47
  240. package/out/constraints/refinements/regex.d.ts.map +0 -1
  241. package/out/constraints/refinements/regex.js +0 -37
  242. package/out/constraints/refinements/regex.js.map +0 -1
  243. package/out/constraints/refinements/shared.d.ts +0 -20
  244. package/out/constraints/refinements/shared.d.ts.map +0 -1
  245. package/out/constraints/refinements/shared.js +0 -10
  246. package/out/constraints/refinements/shared.js.map +0 -1
  247. package/out/generic.d.ts.map +0 -1
  248. package/out/inference.d.ts +0 -137
  249. package/out/inference.d.ts.map +0 -1
  250. package/out/inference.js +0 -73
  251. package/out/inference.js.map +0 -1
  252. package/out/keywords/ark.d.ts +0 -70
  253. package/out/keywords/ark.d.ts.map +0 -1
  254. package/out/keywords/ark.js +0 -29
  255. package/out/keywords/ark.js.map +0 -1
  256. package/out/keywords/internal.d.ts +0 -13
  257. package/out/keywords/internal.d.ts.map +0 -1
  258. package/out/keywords/internal.js +0 -13
  259. package/out/keywords/internal.js.map +0 -1
  260. package/out/keywords/jsObject.d.ts +0 -20
  261. package/out/keywords/jsObject.d.ts.map +0 -1
  262. package/out/keywords/jsObject.js +0 -18
  263. package/out/keywords/jsObject.js.map +0 -1
  264. package/out/keywords/parsing.d.ts +0 -17
  265. package/out/keywords/parsing.d.ts.map +0 -1
  266. package/out/keywords/parsing.js +0 -64
  267. package/out/keywords/parsing.js.map +0 -1
  268. package/out/keywords/root.d.ts +0 -7
  269. package/out/keywords/root.d.ts.map +0 -1
  270. package/out/keywords/root.js +0 -4
  271. package/out/keywords/root.js.map +0 -1
  272. package/out/keywords/tsGenerics.d.ts +0 -2
  273. package/out/keywords/tsGenerics.d.ts.map +0 -1
  274. package/out/keywords/tsGenerics.js +0 -26
  275. package/out/keywords/tsGenerics.js.map +0 -1
  276. package/out/keywords/tsPrimitive.d.ts +0 -24
  277. package/out/keywords/tsPrimitive.d.ts.map +0 -1
  278. package/out/keywords/tsPrimitive.js +0 -25
  279. package/out/keywords/tsPrimitive.js.map +0 -1
  280. package/out/keywords/utils/creditCard.d.ts +0 -11
  281. package/out/keywords/utils/creditCard.d.ts.map +0 -1
  282. package/out/keywords/utils/creditCard.js +0 -35
  283. package/out/keywords/utils/creditCard.js.map +0 -1
  284. package/out/keywords/utils/date.d.ts +0 -45
  285. package/out/keywords/utils/date.d.ts.map +0 -1
  286. package/out/keywords/utils/date.js +0 -56
  287. package/out/keywords/utils/date.js.map +0 -1
  288. package/out/keywords/validation.d.ts +0 -20
  289. package/out/keywords/validation.d.ts.map +0 -1
  290. package/out/keywords/validation.js +0 -80
  291. package/out/keywords/validation.js.map +0 -1
  292. package/out/kinds.d.ts +0 -102
  293. package/out/kinds.d.ts.map +0 -1
  294. package/out/kinds.js +0 -29
  295. package/out/kinds.js.map +0 -1
  296. package/out/main.d.ts.map +0 -1
  297. package/out/match.d.ts.map +0 -1
  298. package/out/module.d.ts.map +0 -1
  299. package/out/parse.d.ts +0 -29
  300. package/out/parse.d.ts.map +0 -1
  301. package/out/parse.js +0 -161
  302. package/out/parse.js.map +0 -1
  303. package/out/parser/definition.d.ts.map +0 -1
  304. package/out/parser/generic.d.ts.map +0 -1
  305. package/out/parser/objectLiteral.d.ts.map +0 -1
  306. package/out/parser/semantic/bounds.d.ts.map +0 -1
  307. package/out/parser/semantic/divisor.d.ts.map +0 -1
  308. package/out/parser/semantic/infer.d.ts.map +0 -1
  309. package/out/parser/semantic/utils.d.ts.map +0 -1
  310. package/out/parser/semantic/validate.d.ts.map +0 -1
  311. package/out/parser/string/reduce/dynamic.d.ts.map +0 -1
  312. package/out/parser/string/reduce/shared.d.ts.map +0 -1
  313. package/out/parser/string/reduce/static.d.ts.map +0 -1
  314. package/out/parser/string/shift/operand/date.d.ts.map +0 -1
  315. package/out/parser/string/shift/operand/enclosed.d.ts.map +0 -1
  316. package/out/parser/string/shift/operand/genericArgs.d.ts.map +0 -1
  317. package/out/parser/string/shift/operand/operand.d.ts.map +0 -1
  318. package/out/parser/string/shift/operand/unenclosed.d.ts.map +0 -1
  319. package/out/parser/string/shift/operator/bounds.d.ts.map +0 -1
  320. package/out/parser/string/shift/operator/divisor.d.ts.map +0 -1
  321. package/out/parser/string/shift/operator/operator.d.ts.map +0 -1
  322. package/out/parser/string/shift/scanner.d.ts.map +0 -1
  323. package/out/parser/string/string.d.ts.map +0 -1
  324. package/out/parser/tuple.d.ts.map +0 -1
  325. package/out/schema.d.ts +0 -175
  326. package/out/schema.d.ts.map +0 -1
  327. package/out/schema.js +0 -73
  328. package/out/schema.js.map +0 -1
  329. package/out/schemaScope.d.ts +0 -180
  330. package/out/schemaScope.d.ts.map +0 -1
  331. package/out/schemaScope.js +0 -235
  332. package/out/schemaScope.js.map +0 -1
  333. package/out/scope.d.ts.map +0 -1
  334. package/out/shared/compile.d.ts +0 -22
  335. package/out/shared/compile.d.ts.map +0 -1
  336. package/out/shared/compile.js +0 -79
  337. package/out/shared/compile.js.map +0 -1
  338. package/out/shared/context.d.ts +0 -54
  339. package/out/shared/context.d.ts.map +0 -1
  340. package/out/shared/context.js +0 -53
  341. package/out/shared/context.js.map +0 -1
  342. package/out/shared/declare.d.ts +0 -69
  343. package/out/shared/declare.d.ts.map +0 -1
  344. package/out/shared/declare.js +0 -2
  345. package/out/shared/declare.js.map +0 -1
  346. package/out/shared/disjoint.d.ts +0 -91
  347. package/out/shared/disjoint.d.ts.map +0 -1
  348. package/out/shared/disjoint.js +0 -110
  349. package/out/shared/disjoint.js.map +0 -1
  350. package/out/shared/errors.d.ts +0 -99
  351. package/out/shared/errors.d.ts.map +0 -1
  352. package/out/shared/errors.js +0 -108
  353. package/out/shared/errors.js.map +0 -1
  354. package/out/shared/implement.d.ts +0 -363
  355. package/out/shared/implement.d.ts.map +0 -1
  356. package/out/shared/implement.js +0 -68
  357. package/out/shared/implement.js.map +0 -1
  358. package/out/shared/inference.d.ts +0 -6
  359. package/out/shared/inference.d.ts.map +0 -1
  360. package/out/shared/inference.js +0 -5
  361. package/out/shared/inference.js.map +0 -1
  362. package/out/shared/intersections.d.ts +0 -60
  363. package/out/shared/intersections.d.ts.map +0 -1
  364. package/out/shared/intersections.js +0 -2
  365. package/out/shared/intersections.js.map +0 -1
  366. package/out/shared/traversal.d.ts +0 -62
  367. package/out/shared/traversal.d.ts.map +0 -1
  368. package/out/shared/traversal.js +0 -97
  369. package/out/shared/traversal.js.map +0 -1
  370. package/out/shared/utils.d.ts +0 -24
  371. package/out/shared/utils.d.ts.map +0 -1
  372. package/out/shared/utils.js +0 -15
  373. package/out/shared/utils.js.map +0 -1
  374. package/out/type.d.ts.map +0 -1
  375. package/out/types/basis.d.ts +0 -47
  376. package/out/types/basis.d.ts.map +0 -1
  377. package/out/types/basis.js +0 -15
  378. package/out/types/basis.js.map +0 -1
  379. package/out/types/discriminate.d.ts +0 -34
  380. package/out/types/discriminate.d.ts.map +0 -1
  381. package/out/types/discriminate.js +0 -120
  382. package/out/types/discriminate.js.map +0 -1
  383. package/out/types/domain.d.ts +0 -57
  384. package/out/types/domain.d.ts.map +0 -1
  385. package/out/types/domain.js +0 -41
  386. package/out/types/domain.js.map +0 -1
  387. package/out/types/intersection.d.ts +0 -127
  388. package/out/types/intersection.d.ts.map +0 -1
  389. package/out/types/intersection.js +0 -379
  390. package/out/types/intersection.js.map +0 -1
  391. package/out/types/morph.d.ts +0 -157
  392. package/out/types/morph.d.ts.map +0 -1
  393. package/out/types/morph.js +0 -99
  394. package/out/types/morph.js.map +0 -1
  395. package/out/types/proto.d.ts +0 -51
  396. package/out/types/proto.d.ts.map +0 -1
  397. package/out/types/proto.js +0 -60
  398. package/out/types/proto.js.map +0 -1
  399. package/out/types/type.d.ts +0 -143
  400. package/out/types/type.d.ts.map +0 -1
  401. package/out/types/type.js +0 -123
  402. package/out/types/type.js.map +0 -1
  403. package/out/types/union.d.ts +0 -71
  404. package/out/types/union.d.ts.map +0 -1
  405. package/out/types/union.js +0 -379
  406. package/out/types/union.js.map +0 -1
  407. package/out/types/unit.d.ts +0 -45
  408. package/out/types/unit.d.ts.map +0 -1
  409. package/out/types/unit.js +0 -56
  410. package/out/types/unit.js.map +0 -1
  411. package/out/util.d.ts +0 -31
  412. package/out/util.d.ts.map +0 -1
  413. package/out/util.js +0 -8
  414. package/out/util.js.map +0 -1
@@ -14,15 +14,15 @@ contextualize(
14
14
  const t = type("string[]")
15
15
  attest<string[]>(t.infer)
16
16
  attest(t.allows([])).equals(true)
17
- attest(t([]).out).snap([])
17
+ attest(t([])).snap([])
18
18
  attest(t.allows(["foo", "bar"])).equals(true)
19
- attest(t(["foo", "bar"]).out).snap(["foo", "bar"])
19
+ attest(t(["foo", "bar"])).snap(["foo", "bar"])
20
20
  attest(t.allows(["foo", "bar", 5])).equals(false)
21
- attest(t(["foo", "bar", 5]).errors?.summary).snap(
21
+ attest(t(["foo", "bar", 5]).toString()).snap(
22
22
  "value at [2] must be a string (was number)"
23
23
  )
24
24
  attest(t.allows([5, "foo", "bar"])).equals(false)
25
- attest(t([5, "foo", "bar"]).errors?.summary).snap(
25
+ attest(t([5, "foo", "bar"]).toString()).snap(
26
26
  "value at [0] must be a string (was number)"
27
27
  )
28
28
  })
@@ -31,15 +31,15 @@ contextualize(
31
31
  const t = type("string[][]")
32
32
  attest<string[][]>(t.infer)
33
33
  attest(t.allows([])).equals(true)
34
- attest(t([]).out).snap([])
34
+ attest(t([])).snap([])
35
35
  attest(t.allows([["foo"]])).equals(true)
36
- attest(t([["foo"]]).out).snap([["foo"]])
36
+ attest(t([["foo"]])).snap([["foo"]])
37
37
  attest(t.allows(["foo"])).equals(false)
38
- attest(t(["foo"]).errors?.summary).snap(
38
+ attest(t(["foo"]).toString()).snap(
39
39
  "value at [0] must be an array (was string)"
40
40
  )
41
41
  attest(t.allows([["foo", 5]])).equals(false)
42
- attest(t([["foo", 5]]).errors?.summary).snap(
42
+ attest(t([["foo", 5]]).toString()).snap(
43
43
  "value at [0][1] must be a string (was number)"
44
44
  )
45
45
  })
@@ -79,23 +79,21 @@ contextualize(
79
79
  const t = type(["string", "number"])
80
80
  attest<[string, number]>(t.infer)
81
81
  attest(t.allows(["", 0])).equals(true)
82
- attest(t(["", 0]).out).snap(["", 0])
82
+ attest(t(["", 0])).snap(["", 0])
83
83
  attest(t.allows([true, 0])).equals(false)
84
- attest(t([true, 0]).errors?.summary).snap(
84
+ attest(t([true, 0]).toString()).snap(
85
85
  "value at [0] must be a string (was true)"
86
86
  )
87
87
  attest(t.allows([0, false])).equals(false)
88
- attest(t([0, false]).errors?.summary)
88
+ attest(t([0, false]).toString())
89
89
  .snap(`value at [0] must be a string (was number)
90
90
  value at [1] must be a number (was false)`)
91
91
  // too short
92
92
  attest(t.allows([""])).equals(false)
93
- attest(t([""]).errors?.summary).snap(
94
- 'must be exactly length 2 (was [""])'
95
- )
93
+ attest(t([""]).toString()).snap('must be exactly length 2 (was [""])')
96
94
  // too long
97
95
  attest(t.allows(["", 0, 1])).equals(false)
98
- attest(t(["", 0, 1]).errors?.summary).snap(
96
+ attest(t(["", 0, 1]).toString()).snap(
99
97
  'must be exactly length 2 (was ["",0,1])'
100
98
  )
101
99
  // non-array
@@ -111,7 +109,7 @@ value at [1] must be a number (was false)`)
111
109
  length: 2,
112
110
  0: "",
113
111
  1: 0
114
- }).errors?.summary
112
+ }).toString()
115
113
  ).snap("must be an array (was object)")
116
114
  })
117
115
 
@@ -130,10 +128,10 @@ value at [1] must be a number (was false)`)
130
128
  >(t.infer)
131
129
  const valid: typeof t.infer = [["", 0], [{ a: 0n, b: [null] }]]
132
130
  attest(t.allows(valid)).equals(true)
133
- attest(t(valid).out).equals(valid)
131
+ attest(t(valid)).equals(valid)
134
132
  const invalid = [["", 0], [{ a: 0n, b: [undefined] }]]
135
133
  attest(t.allows(invalid)).equals(false)
136
- attest(t(invalid).errors?.summary).snap(
134
+ attest(t(invalid).toString()).snap(
137
135
  "value at [1][0].b[0] must be null (was undefined)"
138
136
  )
139
137
  })
@@ -141,12 +139,12 @@ value at [1] must be a number (was false)`)
141
139
  it("optional tuple", () => {
142
140
  const t = type(["string", "?"])
143
141
  attest<[string?]>(t.infer)
144
- attest(t([]).errors).equals(undefined)
145
- attest(t(["foo"]).errors).equals(undefined)
146
- attest(t([5]).errors?.summary).snap(
142
+ attest(t([])).equals([])
143
+ attest(t(["foo"])).equals(["foo"])
144
+ attest(t([5]).toString()).snap(
147
145
  "value at [0] must be a string (was number)"
148
146
  )
149
- attest(t(["foo", "bar"]).errors?.summary).snap(
147
+ attest(t(["foo", "bar"]).toString()).snap(
150
148
  "must be at most length 1 (was 2)"
151
149
  )
152
150
  })
@@ -161,8 +159,8 @@ value at [1] must be a number (was false)`)
161
159
  it("spreads simple arrays", () => {
162
160
  const wellRested = type(["string", "...", "number[]"])
163
161
  attest<[string, ...number[]]>(wellRested.infer)
164
- attest(wellRested(["foo"]).out).equals(["foo"])
165
- attest(wellRested(["foo", 1, 2]).out).equals(["foo", 1, 2])
162
+ attest(wellRested(["foo"])).equals(["foo"])
163
+ attest(wellRested(["foo", 1, 2])).equals(["foo", 1, 2])
166
164
  })
167
165
 
168
166
  it("spreads array expressions", () => {
@@ -386,7 +384,7 @@ value at [1] must be a number (was false)`)
386
384
  // describe("traversal", () => {
387
385
  // it("multiple errors", () => {
388
386
  // const stringArray = type("string[]")
389
- // attest(stringArray([1, 2]).errors?.summary).snap(
387
+ // attest(stringArray([1, 2]).toString()).snap(
390
388
  // "Item at index 0 must be a string (was number)\nItem at index 1 must be a string (was number)"
391
389
  // )
392
390
  // })
@@ -12,11 +12,11 @@ contextualize(() => {
12
12
  }).export()
13
13
  attest<string>(types.a.infer)
14
14
  attest(types.a.description).equals(description)
15
- attest(types.a(1).errors?.summary).snap(
15
+ attest(types.a(1).toString()).snap(
16
16
  "must be a series of characters (was number)"
17
17
  )
18
18
  attest<{ a: string }>(types.b.infer)
19
- attest(types.b({ a: true }).errors?.summary).snap(
19
+ attest(types.b({ a: true }).toString()).snap(
20
20
  "a must be a series of characters (was true)"
21
21
  )
22
22
  })
@@ -30,7 +30,7 @@ contextualize(() => {
30
30
  attest(t.description).snap(
31
31
  "{ monster: the number of dimensions in the monster group }"
32
32
  )
33
- attest(t({ monster: 196882 }).errors?.summary).snap(
33
+ attest(t({ monster: 196882 }).toString()).snap(
34
34
  "monster must be the number of dimensions in the monster group (was 196882)"
35
35
  )
36
36
  })
@@ -38,13 +38,13 @@ contextualize(() => {
38
38
  it("anonymous type config", () => {
39
39
  const t = type(type("true", "@", { description: "unfalse" }))
40
40
  attest<true>(t.infer)
41
- attest(t(false).errors?.summary).snap("must be unfalse (was false)")
41
+ attest(t(false).toString()).snap("must be unfalse (was false)")
42
42
  })
43
43
 
44
44
  it("anonymous type config at path", () => {
45
45
  const unfalse = type("true", "@", { description: "unfalse" })
46
46
  const t = type({ myKey: unfalse })
47
- attest(t({ myKey: "500" }).errors?.summary).snap(
47
+ attest(t({ myKey: "500" }).toString()).snap(
48
48
  `myKey must be unfalse (was "500")`
49
49
  )
50
50
  })
@@ -60,7 +60,7 @@ contextualize(() => {
60
60
  myKey: () => type("false", "@", { description: "untrue" })
61
61
  })
62
62
  attest<{ myKey: false }>(t.infer)
63
- attest(t({ myKey: true }).errors?.summary).snap(
63
+ attest(t({ myKey: true }).toString()).snap(
64
64
  "myKey must be untrue (was true)"
65
65
  )
66
66
  })
@@ -76,10 +76,21 @@ contextualize(() => {
76
76
  user({
77
77
  name: "david",
78
78
  age: true
79
- }).errors?.summary
79
+ }).toString()
80
80
  ).snap("age must be a number (was true)")
81
81
 
82
82
  // should give the shallow custom error
83
- attest(user(null).errors?.summary).snap("must be a valid user (was null)")
83
+ attest(user(null).toString()).snap("must be a valid user (was null)")
84
+ })
85
+
86
+ it("jitless", () => {
87
+ const types = scope(
88
+ {
89
+ fast: "false"
90
+ },
91
+ { jitless: true }
92
+ ).export()
93
+
94
+ attest(types.fast.raw.jit).equals(false)
84
95
  })
85
96
  })
@@ -6,7 +6,7 @@
6
6
  // version: string
7
7
  // contributors?: string[]
8
8
  // }
9
- // attest(typeSnippet.errors?.summary).snap(
9
+ // attest(typeSnippet.toString()).snap(
10
10
  // "contributors must be more than 1 items long (was 1)"
11
11
  // )
12
12
  // })
@@ -19,7 +19,7 @@
19
19
  // version?: number
20
20
  // }
21
21
  // }
22
- // attest(typeSnippet.errors?.summary).snap(
22
+ // attest(typeSnippet.toString()).snap(
23
23
  // "device/platform must be 'android' or 'ios' (was 'enigma')"
24
24
  // )
25
25
  // })
@@ -34,7 +34,7 @@
34
34
  // // packages?: any[]
35
35
  // // }[]
36
36
  // // }
37
- // // attest(scopeSnippet.errors?.summary).snap(
37
+ // // attest(scopeSnippet.toString()).snap(
38
38
  // // "dependencies/0/dependencies/0/contributors/0/email must be a valid email (was 'david@sharktypeio')\ncontributors/0/email must be a valid email (was 'david@sharktypeio')"
39
39
  // // )
40
40
  // // })
@@ -1,4 +1,5 @@
1
1
  import { attest, contextualize } from "@arktype/attest"
2
+ import { writeDuplicateAliasError } from "@arktype/schema"
2
3
  import { lazily } from "@arktype/util"
3
4
  import { type Module, scope, type } from "arktype"
4
5
  import { writePrefixedPrivateReferenceMessage } from "../parser/semantic/validate.js"
@@ -39,18 +40,6 @@ contextualize(() => {
39
40
  attest<{ a: 3 | 60 | "no" | "yes" | true }>(imported.infer)
40
41
  })
41
42
 
42
- // TODO: fix, tests for more duplicate scenarios
43
- // it("duplicate alias", () => {
44
- // attest(() =>
45
- // scope({ a: "boolean" })
46
- // .scope(
47
- // // @ts-expect-error
48
- // { a: "string" }
49
- // )
50
- // .export()
51
- // ).throwsAndHasTypeError(writeDuplicateAliasesMessage("a"))
52
- // })
53
-
54
43
  it("import & export", () => {
55
44
  const threeSixtyNoScope = scope({
56
45
  three: "3",
@@ -109,6 +98,23 @@ contextualize(() => {
109
98
  ).throwsAndHasTypeError(writePrefixedPrivateReferenceMessage("#kekw"))
110
99
  })
111
100
 
101
+ it("errors on public and private refrence with same name", () => {
102
+ attest(() =>
103
+ scope({
104
+ kekw: "1",
105
+ // @ts-expect-error
106
+ "#kekw": "1"
107
+ }).export()
108
+ ).throwsAndHasTypeError(writeDuplicateAliasError("kekw"))
109
+ attest(() =>
110
+ scope({
111
+ // @ts-expect-error
112
+ "#kekw": "1",
113
+ kekw: "1"
114
+ }).export()
115
+ ).throwsAndHasTypeError(writeDuplicateAliasError("kekw"))
116
+ })
117
+
112
118
  // TODO: reenable
113
119
  // it("generic", () => {
114
120
  // const types = scope({
@@ -13,8 +13,8 @@ contextualize(
13
13
  const expected = rawSchema(Error)
14
14
  attest(t.json).equals(expected.json)
15
15
  const e = new Error()
16
- attest(t(e).out).equals(e)
17
- attest(t({}).errors?.summary).snap("must be an Error (was object)")
16
+ attest(t(e)).equals(e)
17
+ attest(t({}).toString()).snap("must be an Error (was object)")
18
18
  })
19
19
  it("inherited", () => {
20
20
  const t = type(["instanceof", TypeError])
@@ -22,8 +22,8 @@ contextualize(
22
22
  // for some reason the return of TypeError's constructor is actually
23
23
  // inferred as Error? Disabling this check for now, seems like an anomaly.
24
24
  // attest<TypeError>(t.infer)
25
- attest(t(e).out).equals(e)
26
- attest(t(new Error()).errors?.summary).snap(
25
+ attest(t(e)).equals(e)
26
+ attest(t(new Error()).toString()).snap(
27
27
  "must be an instance of TypeError (was Error)"
28
28
  )
29
29
  })
@@ -37,7 +37,7 @@ contextualize(
37
37
  const t = type(["instanceof", Base])
38
38
  attest<Base>(t.infer)
39
39
  const sub = new Sub()
40
- attest(t(sub).out).equals(sub)
40
+ attest(t(sub)).equals(sub)
41
41
  })
42
42
  it("multiple branches", () => {
43
43
  const t = type(["instanceof", Date, Array])
@@ -59,8 +59,8 @@ contextualize(
59
59
  attest(ark.infer).type.toString("ArkClass")
60
60
  attest(ark.in.infer).type.toString("ArkClass")
61
61
  const a = new ArkClass()
62
- attest(ark(a).out).equals(a)
63
- attest(ark({}).errors?.summary).snap(
62
+ attest(ark(a)).equals(a)
63
+ attest(ark({}).toString()).snap(
64
64
  "must be an instance of ArkClass (was object)"
65
65
  )
66
66
  })
@@ -42,9 +42,9 @@ contextualize(() => {
42
42
  })
43
43
 
44
44
  it("chained deep intersections", () => {
45
- const b = type({ b: "boolean" }, "=>", (o) => [o.b])
45
+ const b = type({ b: "boolean" }, "=>", o => [o.b])
46
46
  const t = type({
47
- a: ["string", "=>", (s) => s.length]
47
+ a: ["string", "=>", s => s.length]
48
48
  })
49
49
  .and({
50
50
  // unable to inline this due to:
@@ -6,14 +6,14 @@
6
6
  // a: "string"
7
7
  // })
8
8
  // const dataWithExtraneousB = getExtraneousB()
9
- // attest(t(dataWithExtraneousB).out).equals(dataWithExtraneousB)
9
+ // attest(t(dataWithExtraneousB)).equals(dataWithExtraneousB)
10
10
  // })
11
11
  //
12
12
  // it("invalid union", () => {
13
13
  // const o = type([{ a: "string" }, "|", { b: "boolean" }]).configure({
14
14
  // keys: "strict"
15
15
  // })
16
- // attest(o({ a: 2 }).errors?.summary).snap(
16
+ // attest(o({ a: 2 }).toString()).snap(
17
17
  // 'a must be a string or removed (was {"a":2})'
18
18
  // )
19
19
  // })
@@ -22,22 +22,22 @@
22
22
  // const t = type({
23
23
  // a: "string"
24
24
  // }).configure({ keys: "distilled" })
25
- // attest(t({ a: "ok" }).out).equals({ a: "ok" })
26
- // attest(t(getExtraneousB()).out).snap({ a: "ok" })
25
+ // attest(t({ a: "ok" })).equals({ a: "ok" })
26
+ // attest(t(getExtraneousB())).snap({ a: "ok" })
27
27
  // })
28
28
  //
29
29
  // it("distilled array", () => {
30
30
  // const o = type({ a: "email[]" }).configure({
31
31
  // keys: "distilled"
32
32
  // })
33
- // attest(o({ a: ["shawn@arktype.io"] }).out).snap({
33
+ // attest(o({ a: ["shawn@arktype.io"] })).snap({
34
34
  // a: ["shawn@arktype.io"]
35
35
  // })
36
- // attest(o({ a: ["notAnEmail"] }).errors?.summary).snap(
36
+ // attest(o({ a: ["notAnEmail"] }).toString()).snap(
37
37
  // "a/0 must be a valid email (was 'notAnEmail')"
38
38
  // )
39
39
  // // can handle missing keys
40
- // attest(o({ b: ["shawn"] }).errors?.summary).snap("a must be defined")
40
+ // attest(o({ b: ["shawn"] }).toString()).snap("a must be defined")
41
41
  // })
42
42
  //
43
43
  // it("distilled union", () => {
@@ -45,11 +45,11 @@
45
45
  // keys: "distilled"
46
46
  // })
47
47
  // // can distill to first branch
48
- // attest(o({ a: "to", z: "bra" }).out).snap({ a: "to" })
48
+ // attest(o({ a: "to", z: "bra" })).snap({ a: "to" })
49
49
  // // can distill to second branch
50
- // attest(o({ b: true, c: false }).out).snap({ b: true })
50
+ // attest(o({ b: true, c: false })).snap({ b: true })
51
51
  // // can handle missing keys
52
- // attest(o({ a: 2 }).errors?.summary).snap(
52
+ // attest(o({ a: 2 }).toString()).snap(
53
53
  // 'a must be a string or b must be defined (was {"a":2})'
54
54
  // )
55
55
  // })
@@ -58,19 +58,19 @@
58
58
  // const t = type({
59
59
  // a: "string"
60
60
  // }).configure({ keys: "strict" })
61
- // attest(t({ a: "ok" }).out).equals({ a: "ok" })
62
- // attest(t(getExtraneousB()).errors?.summary).snap("b must be removed")
61
+ // attest(t({ a: "ok" })).equals({ a: "ok" })
62
+ // attest(t(getExtraneousB()).toString()).snap("b must be removed")
63
63
  // })
64
64
  //
65
65
  // it("strict array", () => {
66
66
  // const o = type({ a: "string[]" }).configure({
67
67
  // keys: "strict"
68
68
  // })
69
- // attest(o({ a: ["shawn"] }).out).snap({ a: ["shawn"] })
70
- // attest(o({ a: [2] }).errors?.summary).snap(
69
+ // attest(o({ a: ["shawn"] })).snap({ a: ["shawn"] })
70
+ // attest(o({ a: [2] }).toString()).snap(
71
71
  // "a/0 must be a string (was number)"
72
72
  // )
73
- // attest(o({ b: ["shawn"] }).errors?.summary).snap(
73
+ // attest(o({ b: ["shawn"] }).toString()).snap(
74
74
  // "b must be removed\na must be defined"
75
75
  // )
76
76
  // })
@@ -1,6 +1,6 @@
1
1
  import { attest, contextualize } from "@arktype/attest"
2
2
  import { rawSchema } from "@arktype/schema"
3
- import { type } from "arktype"
3
+ import { ark, type } from "arktype"
4
4
 
5
5
  contextualize(
6
6
  "jsObjects",
@@ -28,7 +28,7 @@ contextualize(
28
28
  */
29
29
  const string = type("string")
30
30
  attest<string>(string.infer)
31
- attest(string("string").out).snap("string")
31
+ attest(string("string")).snap("string")
32
32
  })
33
33
 
34
34
  it("any", () => {
@@ -39,6 +39,12 @@ contextualize(
39
39
  attest<any>(any.infer)
40
40
  })
41
41
 
42
+ it("any in expression", () => {
43
+ const t = type("string&any")
44
+ attest<any>(t.infer)
45
+ attest(t.json).equals(ark.string.json)
46
+ })
47
+
42
48
  it("boolean", () => {
43
49
  const boolean = type("boolean")
44
50
  attest<boolean>(boolean.infer)
@@ -59,6 +65,13 @@ contextualize(
59
65
  attest(never.json).equals(expected.json)
60
66
  })
61
67
 
68
+ // TODO: ??
69
+ it("never in union", () => {
70
+ const t = type("string|never")
71
+ attest<string>(t.infer)
72
+ attest(t.json).equals(ark.string.json)
73
+ })
74
+
62
75
  it("unknown", () => {
63
76
  const expected = rawSchema({})
64
77
  // should be equivalent to an unconstrained predicate
@@ -78,84 +91,84 @@ contextualize(
78
91
  // describe("validation", () => {
79
92
  // it("integer", () => {
80
93
  // const integer = type("integer")
81
- // attest(integer(123).out).equals(123)
82
- // attest(integer("123").errors?.summary).equals(
94
+ // attest(integer(123)).equals(123)
95
+ // attest(integer("123").toString()).equals(
83
96
  // "must be a number (was string)"
84
97
  // )
85
- // attest(integer(12.12).errors?.summary).equals(
98
+ // attest(integer(12.12).toString()).equals(
86
99
  // "must be an integer (was 12.12)"
87
100
  // )
88
101
  // })
89
102
  // it("alpha", () => {
90
103
  // const alpha = type("alpha")
91
- // attest(alpha("user").out).equals("user")
92
- // attest(alpha("user123").errors?.summary).equals(
104
+ // attest(alpha("user")).equals("user")
105
+ // attest(alpha("user123").toString()).equals(
93
106
  // "must be only letters (was 'user123')"
94
107
  // )
95
108
  // })
96
109
  // it("alphanumeric", () => {
97
110
  // const alphanumeric = type("alphanumeric")
98
- // attest(alphanumeric("user123").out).equals("user123")
99
- // attest(alphanumeric("user").out).equals("user")
100
- // attest(alphanumeric("123").out).equals("123")
101
- // attest(alphanumeric("abc@123").errors?.summary).equals(
111
+ // attest(alphanumeric("user123")).equals("user123")
112
+ // attest(alphanumeric("user")).equals("user")
113
+ // attest(alphanumeric("123")).equals("123")
114
+ // attest(alphanumeric("abc@123").toString()).equals(
102
115
  // "must be only letters and digits (was 'abc@123')"
103
116
  // )
104
117
  // })
105
118
  // it("lowercase", () => {
106
119
  // const lowercase = type("lowercase")
107
- // attest(lowercase("var").out).equals("var")
108
- // attest(lowercase("newVar").errors?.summary).equals(
120
+ // attest(lowercase("var")).equals("var")
121
+ // attest(lowercase("newVar").toString()).equals(
109
122
  // "must be only lowercase letters (was 'newVar')"
110
123
  // )
111
124
  // })
112
125
  // it("uppercase", () => {
113
126
  // const uppercase = type("uppercase")
114
- // attest(uppercase("VAR").out).equals("VAR")
115
- // attest(uppercase("CONST_VAR").errors?.summary).equals(
127
+ // attest(uppercase("VAR")).equals("VAR")
128
+ // attest(uppercase("CONST_VAR").toString()).equals(
116
129
  // "must be only uppercase letters (was 'CONST_VAR')"
117
130
  // )
118
- // attest(uppercase("myVar").errors?.summary).equals(
131
+ // attest(uppercase("myVar").toString()).equals(
119
132
  // "must be only uppercase letters (was 'myVar')"
120
133
  // )
121
134
  // })
122
135
  // it("email", () => {
123
136
  // const email = type("email")
124
- // attest(email("shawn@mail.com").out).equals("shawn@mail.com")
125
- // attest(email("shawn@email").errors?.summary).equals(
137
+ // attest(email("shawn@mail.com")).equals("shawn@mail.com")
138
+ // attest(email("shawn@email").toString()).equals(
126
139
  // "must be a valid email (was 'shawn@email')"
127
140
  // )
128
141
  // })
129
142
  // it("uuid", () => {
130
143
  // const uuid = type("uuid")
131
- // attest(uuid("f70b8242-dd57-4e6b-b0b7-649d997140a0").out).equals(
144
+ // attest(uuid("f70b8242-dd57-4e6b-b0b7-649d997140a0")).equals(
132
145
  // "f70b8242-dd57-4e6b-b0b7-649d997140a0"
133
146
  // )
134
- // attest(uuid("1234").errors?.summary).equals(
147
+ // attest(uuid("1234").toString()).equals(
135
148
  // "must be a valid UUID (was '1234')"
136
149
  // )
137
150
  // })
138
151
  // it("parsedNumber", () => {
139
152
  // const parsedNumber = type("parsedNumber")
140
- // attest(parsedNumber("5").out).equals(5)
141
- // attest(parsedNumber("5.5").out).equals(5.5)
142
- // attest(parsedNumber("five").errors?.summary).equals(
153
+ // attest(parsedNumber("5")).equals(5)
154
+ // attest(parsedNumber("5.5")).equals(5.5)
155
+ // attest(parsedNumber("five").toString()).equals(
143
156
  // "must be a well-formed numeric string (was 'five')"
144
157
  // )
145
158
  // })
146
159
  // it("parsedInteger", () => {
147
160
  // const parsedInteger = type("parsedInteger")
148
- // attest(parsedInteger("5").out).equals(5)
149
- // attest(parsedInteger("5.5").errors?.summary).equals(
161
+ // attest(parsedInteger("5")).equals(5)
162
+ // attest(parsedInteger("5.5").toString()).equals(
150
163
  // "must be a well-formed integer string (was '5.5')"
151
164
  // )
152
- // attest(parsedInteger("five").errors?.summary).equals(
165
+ // attest(parsedInteger("five").toString()).equals(
153
166
  // "must be a well-formed integer string (was 'five')"
154
167
  // )
155
- // attest(parsedInteger(5).errors?.summary).equals(
168
+ // attest(parsedInteger(5).toString()).equals(
156
169
  // "must be a string (was number)"
157
170
  // )
158
- // attest(parsedInteger("9007199254740992").errors?.summary).equals(
171
+ // attest(parsedInteger("9007199254740992").toString()).equals(
159
172
  // "must be an integer in the range Number.MIN_SAFE_INTEGER to Number.MAX_SAFE_INTEGER (was '9007199254740992')"
160
173
  // )
161
174
  // })
@@ -164,37 +177,37 @@ contextualize(
164
177
  // attest(parsedDate("5/21/1993").out?.toDateString()).equals(
165
178
  // "Fri May 21 1993"
166
179
  // )
167
- // attest(parsedDate("foo").errors?.summary).equals(
180
+ // attest(parsedDate("foo").toString()).equals(
168
181
  // "must be a valid date (was 'foo')"
169
182
  // )
170
- // attest(parsedDate(5).errors?.summary).equals(
183
+ // attest(parsedDate(5).toString()).equals(
171
184
  // "must be a string (was number)"
172
185
  // )
173
186
  // })
174
187
  // it("json", () => {
175
188
  // const json = type("json")
176
- // attest(json('{"a": "hello"}').out).equals({ a: "hello" })
177
- // attest(json(123).errors?.summary).equals(
189
+ // attest(json('{"a": "hello"}')).equals({ a: "hello" })
190
+ // attest(json(123).toString()).equals(
178
191
  // "must be a JSON-parsable string (was number)"
179
192
  // )
180
193
  // })
181
194
  // it("credit card", () => {
182
195
  // const validCC = "5489582921773376"
183
- // attest(ark.creditCard(validCC).out).equals(validCC)
196
+ // attest(ark.creditCard(validCC)).equals(validCC)
184
197
  // // Regex validation
185
- // attest(ark.creditCard("0".repeat(16)).errors?.summary).equals(
198
+ // attest(ark.creditCard("0".repeat(16)).toString()).equals(
186
199
  // "must be a valid credit card number (was '0000000000000000')"
187
200
  // )
188
201
  // // Luhn validation
189
202
  // attest(
190
- // ark.creditCard(validCC.slice(0, -1) + "0").errors?.summary
203
+ // ark.creditCard(validCC.slice(0, -1) + "0").toString()
191
204
  // ).equals(
192
205
  // "must be a valid credit card number (was '5489582921773370')"
193
206
  // )
194
207
  // })
195
208
  // it("semver", () => {
196
- // attest(ark.semver("1.0.0").out).equals("1.0.0")
197
- // attest(ark.semver("-1.0.0").errors?.summary).equals(
209
+ // attest(ark.semver("1.0.0")).equals("1.0.0")
210
+ // attest(ark.semver("-1.0.0").toString()).equals(
198
211
  // "must be a valid semantic version (see https://semver.org/) (was '-1.0.0')"
199
212
  // )
200
213
  // })