arktype 3.0.0-beta.1 → 3.0.0-rc.0

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 (312) hide show
  1. package/README.md +48 -144
  2. package/out/_internal/regex/charset.d.ts +24 -0
  3. package/out/_internal/regex/escape.d.ts +29 -0
  4. package/out/_internal/regex/execArray.d.ts +24 -0
  5. package/out/_internal/regex/group.d.ts +34 -0
  6. package/out/_internal/regex/index.d.ts +2 -0
  7. package/out/_internal/regex/internal.d.ts +9 -0
  8. package/out/_internal/regex/parse.d.ts +10 -0
  9. package/out/_internal/regex/quantify.d.ts +59 -0
  10. package/out/_internal/regex/regex.d.ts +38 -0
  11. package/out/_internal/regex/state.d.ts +383 -0
  12. package/out/_internal/schema/codecs.d.ts +2 -0
  13. package/out/_internal/schema/config.d.ts +103 -0
  14. package/out/_internal/schema/constraint.d.ts +78 -0
  15. package/out/_internal/schema/errors.d.ts +1 -0
  16. package/out/_internal/schema/generic.d.ts +85 -0
  17. package/out/_internal/schema/i18n.d.ts +3 -0
  18. package/out/_internal/schema/index.d.ts +54 -0
  19. package/out/_internal/schema/internal.d.ts +15 -0
  20. package/out/_internal/schema/intrinsic.d.ts +28 -0
  21. package/out/_internal/schema/kinds.d.ts +76 -0
  22. package/out/_internal/schema/module.d.ts +23 -0
  23. package/out/_internal/schema/mutatesInput.d.ts +2 -0
  24. package/out/_internal/schema/node.d.ts +349 -0
  25. package/out/_internal/schema/parse.d.ts +77 -0
  26. package/out/_internal/schema/parseSchema.d.ts +116 -0
  27. package/out/_internal/schema/predicate.d.ts +46 -0
  28. package/out/_internal/schema/refinements/after.d.ts +32 -0
  29. package/out/_internal/schema/refinements/before.d.ts +32 -0
  30. package/out/_internal/schema/refinements/divisor.d.ts +41 -0
  31. package/out/_internal/schema/refinements/exactLength.d.ts +43 -0
  32. package/out/_internal/schema/refinements/kinds.d.ts +40 -0
  33. package/out/_internal/schema/refinements/max.d.ts +33 -0
  34. package/out/_internal/schema/refinements/maxLength.d.ts +32 -0
  35. package/out/_internal/schema/refinements/min.d.ts +33 -0
  36. package/out/_internal/schema/refinements/minLength.d.ts +32 -0
  37. package/out/_internal/schema/refinements/notEqual.d.ts +38 -0
  38. package/out/_internal/schema/refinements/notEqualLength.d.ts +38 -0
  39. package/out/_internal/schema/refinements/pattern.d.ts +43 -0
  40. package/out/_internal/schema/refinements/range.d.ts +101 -0
  41. package/out/_internal/schema/roots/alias.d.ts +49 -0
  42. package/out/_internal/schema/roots/basis.d.ts +12 -0
  43. package/out/_internal/schema/roots/domain.d.ts +45 -0
  44. package/out/_internal/schema/roots/intersection.d.ts +72 -0
  45. package/out/_internal/schema/roots/morph.d.ts +59 -0
  46. package/out/_internal/schema/roots/proto.d.ts +42 -0
  47. package/out/_internal/schema/roots/root.d.ts +163 -0
  48. package/out/_internal/schema/roots/union.d.ts +146 -0
  49. package/out/_internal/schema/roots/unit.d.ts +36 -0
  50. package/out/_internal/schema/runtime.d.ts +29 -0
  51. package/out/_internal/schema/runtimeLean.d.ts +2 -0
  52. package/out/_internal/schema/runtimeNone.d.ts +2 -0
  53. package/out/_internal/schema/runtimeNoneLean.d.ts +2 -0
  54. package/out/_internal/schema/scope.d.ts +203 -0
  55. package/out/_internal/schema/shared/codecs.d.ts +5 -0
  56. package/out/_internal/schema/shared/compile.d.ts +144 -0
  57. package/out/_internal/schema/shared/configured.d.ts +14 -0
  58. package/out/_internal/schema/shared/declare.d.ts +100 -0
  59. package/out/_internal/schema/shared/disjoint.d.ts +45 -0
  60. package/out/_internal/schema/shared/enWriters.d.ts +30 -0
  61. package/out/_internal/schema/shared/errorModes.d.ts +25 -0
  62. package/out/_internal/schema/shared/errorWriters.d.ts +34 -0
  63. package/out/_internal/schema/shared/errors.d.ts +264 -0
  64. package/out/_internal/schema/shared/implement.d.ts +154 -0
  65. package/out/_internal/schema/shared/inPlace.d.ts +8 -0
  66. package/out/_internal/schema/shared/issueFeatures.d.ts +38 -0
  67. package/out/_internal/schema/shared/issues.d.ts +261 -0
  68. package/out/_internal/schema/shared/issuesLean.d.ts +80 -0
  69. package/out/_internal/schema/shared/issuesNone.d.ts +22 -0
  70. package/out/_internal/schema/shared/issuesNoneLean.d.ts +20 -0
  71. package/out/_internal/schema/shared/issuesUndetailed.d.ts +25 -0
  72. package/out/_internal/schema/shared/jsonSchema.d.ts +153 -0
  73. package/out/_internal/schema/shared/listed.d.ts +15 -0
  74. package/out/_internal/schema/shared/locale.d.ts +149 -0
  75. package/out/_internal/schema/shared/registry.d.ts +16 -0
  76. package/out/_internal/schema/shared/render.d.ts +3 -0
  77. package/out/_internal/schema/shared/rootApply.d.ts +19 -0
  78. package/out/_internal/schema/shared/sets.d.ts +26 -0
  79. package/out/_internal/schema/shared/standardFailure.d.ts +22 -0
  80. package/out/_internal/schema/shared/standardSchema.d.ts +124 -0
  81. package/out/_internal/schema/shared/toJsonSchema.d.ts +229 -0
  82. package/out/_internal/schema/shared/transform.d.ts +35 -0
  83. package/out/_internal/schema/shared/traversal.d.ts +288 -0
  84. package/out/_internal/schema/shared/utils.d.ts +59 -0
  85. package/out/_internal/schema/structure/index.d.ts +43 -0
  86. package/out/_internal/schema/structure/optional.d.ts +61 -0
  87. package/out/_internal/schema/structure/prop.d.ts +45 -0
  88. package/out/_internal/schema/structure/required.d.ts +49 -0
  89. package/out/_internal/schema/structure/sequence.d.ts +127 -0
  90. package/out/_internal/schema/structure/shared.d.ts +3 -0
  91. package/out/_internal/schema/structure/structure.d.ts +178 -0
  92. package/out/_internal/schema/units.d.ts +123 -0
  93. package/out/_internal/sets/algebra.d.ts +26 -0
  94. package/out/_internal/sets/constraint.d.ts +19 -0
  95. package/out/_internal/sets/engine.d.ts +2 -0
  96. package/out/_internal/sets/formats.d.ts +23 -0
  97. package/out/_internal/sets/fromJsonSchema.d.ts +15 -0
  98. package/out/_internal/sets/implement.d.ts +16 -0
  99. package/out/_internal/sets/index.d.ts +2 -0
  100. package/out/_internal/sets/internal.d.ts +20 -0
  101. package/out/_internal/sets/intersections.d.ts +5 -0
  102. package/out/_internal/sets/kinds.d.ts +3 -0
  103. package/out/_internal/sets/refinements.d.ts +14 -0
  104. package/out/_internal/sets/roots/alias.d.ts +3 -0
  105. package/out/_internal/sets/roots/domain.d.ts +3 -0
  106. package/out/_internal/sets/roots/intersection.d.ts +4 -0
  107. package/out/_internal/sets/roots/morph.d.ts +4 -0
  108. package/out/_internal/sets/roots/proto.d.ts +3 -0
  109. package/out/_internal/sets/roots/union.d.ts +16 -0
  110. package/out/_internal/sets/roots/unit.d.ts +3 -0
  111. package/out/_internal/sets/structure/index.d.ts +3 -0
  112. package/out/_internal/sets/structure/prop.d.ts +8 -0
  113. package/out/_internal/sets/structure/sequence.d.ts +3 -0
  114. package/out/_internal/sets/structure/structure.d.ts +3 -0
  115. package/out/_internal/sets/toJsonSchema.d.ts +25 -0
  116. package/out/_internal/util/arrays.d.ts +130 -0
  117. package/out/_internal/util/clone.d.ts +4 -0
  118. package/out/_internal/util/describe.d.ts +25 -0
  119. package/out/_internal/util/domain.d.ts +49 -0
  120. package/out/_internal/util/errors.d.ts +29 -0
  121. package/out/_internal/util/facts.d.ts +22 -0
  122. package/out/_internal/util/flatMorph.d.ts +41 -0
  123. package/out/_internal/util/formats.d.ts +8 -0
  124. package/out/_internal/util/functions.d.ts +33 -0
  125. package/out/_internal/util/generics.d.ts +65 -0
  126. package/out/_internal/util/get.d.ts +9 -0
  127. package/out/_internal/util/hkt.d.ts +27 -0
  128. package/out/_internal/util/i18n.d.ts +12 -0
  129. package/out/_internal/util/index.d.ts +28 -0
  130. package/out/_internal/util/internal.d.ts +2 -0
  131. package/out/_internal/util/intersections.d.ts +50 -0
  132. package/out/_internal/util/isomorphic.d.ts +8 -0
  133. package/out/_internal/util/keys.d.ts +18 -0
  134. package/out/_internal/util/lazily.d.ts +7 -0
  135. package/out/_internal/util/numbers.d.ts +82 -0
  136. package/out/_internal/util/objectKinds.d.ts +157 -0
  137. package/out/_internal/util/path.d.ts +16 -0
  138. package/out/_internal/util/primitive.d.ts +16 -0
  139. package/out/_internal/util/records.d.ts +173 -0
  140. package/out/_internal/util/registry.d.ts +13 -0
  141. package/out/_internal/util/scanner.d.ts +110 -0
  142. package/out/_internal/util/serialize.d.ts +40 -0
  143. package/out/_internal/util/strings.d.ts +35 -0
  144. package/out/_internal/util/traits.d.ts +89 -0
  145. package/out/_internal/util/unionToTuple.d.ts +14 -0
  146. package/out/_internal/util/weak.d.ts +8 -0
  147. package/out/attributes.d.ts +15 -11
  148. package/out/checkers.d.ts +1 -1
  149. package/out/chunk-22RQSVV3.js +0 -0
  150. package/out/chunk-3HZC67MT.js +965 -0
  151. package/out/chunk-3KBOPH3J.js +1564 -0
  152. package/out/chunk-3SH2BQ4T.js +15 -0
  153. package/out/chunk-46PLKNON.js +126 -0
  154. package/out/{chunk-G45P2CLE.js → chunk-4FTHWK63.js} +6 -1
  155. package/out/{chunk-UK5UGFOX.js → chunk-4HREHNIV.js} +23 -11
  156. package/out/chunk-4NZCLVBD.js +14 -0
  157. package/out/chunk-6FMBO47M.js +7 -0
  158. package/out/chunk-7TALAWYX.js +10 -0
  159. package/out/{chunk-DLWCO4RV.js → chunk-BCYKO54Z.js} +11 -2
  160. package/out/chunk-BDJVONP7.js +168 -0
  161. package/out/{chunk-E3DZXEZK.js → chunk-C2JOL5M2.js} +4 -2
  162. package/out/{chunk-2U2AWCI3.js → chunk-C2V6QPE3.js} +126 -97
  163. package/out/chunk-C3B4IFQL.js +6408 -0
  164. package/out/chunk-CWSF57VM.js +10 -0
  165. package/out/chunk-F5BACUJS.js +7 -0
  166. package/out/{chunk-EVCML554.js → chunk-FWRSDUJ2.js} +14 -5
  167. package/out/chunk-GID3FSQA.js +161 -0
  168. package/out/chunk-I2KLQ2HA.js +22 -0
  169. package/out/chunk-K7SLP5D2.js +84 -0
  170. package/out/chunk-KQPSKGUI.js +9 -0
  171. package/out/chunk-KXOC3JEX.js +8234 -0
  172. package/out/chunk-KXOSUYRA.js +405 -0
  173. package/out/chunk-LHNEY6QW.js +0 -0
  174. package/out/chunk-MTWKGAGO.js +323 -0
  175. package/out/chunk-NU73GNCX.js +170 -0
  176. package/out/{chunk-RAZ3TXOE.js → chunk-P5W67FQH.js} +34 -19
  177. package/out/chunk-PDLTEX6Z.js +1118 -0
  178. package/out/{chunk-VV6YDN2D.js → chunk-QUS4IAXJ.js} +304 -263
  179. package/out/chunk-R7WXIH5P.js +94 -0
  180. package/out/chunk-TACLEIDM.js +95 -0
  181. package/out/chunk-UJJGG4VQ.js +71 -0
  182. package/out/chunk-US6BWOGJ.js +109 -0
  183. package/out/chunk-VMMMOO4R.js +945 -0
  184. package/out/chunk-VYMXHSFR.js +439 -0
  185. package/out/chunk-W2XOI5DY.js +141 -0
  186. package/out/chunk-WC5L5YRP.js +25 -0
  187. package/out/{chunk-NRIGTMPM.js → chunk-WKOSL2G6.js} +4 -1
  188. package/out/chunk-XLG66ZDF.js +0 -0
  189. package/out/{chunk-5U2ZMDNI.js → chunk-XNUAQSJ4.js} +52 -30
  190. package/out/chunk-ZRYEHGSG.js +79 -0
  191. package/out/cli.d.ts +28 -0
  192. package/out/cli.js +636 -0
  193. package/out/codecs.d.ts +6 -5
  194. package/out/codecs.js +23 -7
  195. package/out/config.d.ts +5 -17
  196. package/out/config.js +11 -2
  197. package/out/declare.d.ts +40 -12
  198. package/out/deferred.d.ts +2 -2
  199. package/out/errors.d.ts +1 -1
  200. package/out/errors.js +10 -2
  201. package/out/fn.d.ts +20 -13
  202. package/out/fromJsonSchema.d.ts +18 -0
  203. package/out/generic.d.ts +9 -6
  204. package/out/i18n.d.ts +2 -2
  205. package/out/i18n.js +9 -2
  206. package/out/index.d.ts +16 -7
  207. package/out/index.js +25 -8
  208. package/out/internal.d.ts +4 -0
  209. package/out/internal.js +41 -17
  210. package/out/island.js +22 -6
  211. package/out/islandDependency.js +42 -18
  212. package/out/jsonSchema/infer.d.ts +805 -0
  213. package/out/jsonSchema/validate.d.ts +416 -0
  214. package/out/keywords/Array.d.ts +2 -2
  215. package/out/keywords/builtins.d.ts +3 -3
  216. package/out/keywords/constructors.d.ts +1 -1
  217. package/out/keywords/functions.d.ts +5 -192
  218. package/out/keywords/keywords.d.ts +3 -3
  219. package/out/keywords/number.d.ts +2 -2
  220. package/out/keywords/phrases.d.ts +4 -191
  221. package/out/keywords/string.d.ts +3 -3
  222. package/out/keywords/ts.d.ts +18 -18
  223. package/out/keywords/ts.js +19 -4
  224. package/out/locale.d.ts +6 -2
  225. package/out/locales/de.js +9 -2
  226. package/out/locales/en.js +21 -5
  227. package/out/match.d.ts +13 -10
  228. package/out/module.d.ts +2 -2
  229. package/out/mutatesInput.js +18 -3
  230. package/out/nary.d.ts +220 -194
  231. package/out/parser/ast/bounds.d.ts +2 -2
  232. package/out/parser/ast/default.d.ts +2 -2
  233. package/out/parser/ast/divisor.d.ts +2 -2
  234. package/out/parser/ast/generic.d.ts +2 -2
  235. package/out/parser/ast/infer.d.ts +1 -1
  236. package/out/parser/ast/keyof.d.ts +2 -2
  237. package/out/parser/ast/utils.d.ts +1 -1
  238. package/out/parser/ast/validate.d.ts +2 -2
  239. package/out/parser/definition.d.ts +4 -4
  240. package/out/parser/objectLiteral.d.ts +2 -2
  241. package/out/parser/property.d.ts +2 -2
  242. package/out/parser/reduce/dynamic.d.ts +2 -2
  243. package/out/parser/reduce/shared.d.ts +1 -1
  244. package/out/parser/reduce/static.d.ts +1 -1
  245. package/out/parser/shift/operand/enclosed.d.ts +2 -2
  246. package/out/parser/shift/operand/genericArgs.d.ts +2 -2
  247. package/out/parser/shift/operand/operand.d.ts +1 -1
  248. package/out/parser/shift/operand/unenclosed.d.ts +2 -2
  249. package/out/parser/shift/operand/unresolvable.d.ts +2 -2
  250. package/out/parser/shift/operator/bounds.d.ts +2 -2
  251. package/out/parser/shift/operator/brand.d.ts +2 -2
  252. package/out/parser/shift/operator/default.d.ts +4 -4
  253. package/out/parser/shift/operator/divisor.d.ts +1 -1
  254. package/out/parser/shift/operator/operator.d.ts +1 -1
  255. package/out/parser/shift/tokens.d.ts +1 -1
  256. package/out/parser/string.d.ts +2 -2
  257. package/out/parser/tupleExpressions.d.ts +6 -8
  258. package/out/parser/tupleLiteral.d.ts +2 -2
  259. package/out/precompiled.d.ts +1 -1
  260. package/out/precompiled.js +16 -2
  261. package/out/regex.d.ts +1 -0
  262. package/out/regex.js +2 -0
  263. package/out/runtime.d.ts +10 -8
  264. package/out/runtime.js +6 -4
  265. package/out/runtimeDevelopment.js +70 -52
  266. package/out/schema.d.ts +1 -0
  267. package/out/schema.js +15 -0
  268. package/out/schemaInternal.d.ts +1 -0
  269. package/out/schemaInternal.js +1401 -0
  270. package/out/schemaIssueFeatures.d.ts +1 -0
  271. package/out/schemaRuntime.d.ts +1 -0
  272. package/out/schemaRuntime.js +7 -0
  273. package/out/schemaRuntimeLean.d.ts +1 -0
  274. package/out/schemaRuntimeLean.js +1870 -0
  275. package/out/schemaRuntimeNone.d.ts +1 -0
  276. package/out/schemaRuntimeNone.js +1774 -0
  277. package/out/schemaRuntimeNoneLean.d.ts +1 -0
  278. package/out/schemaRuntimeNoneLean.js +1767 -0
  279. package/out/scope.d.ts +3 -4
  280. package/out/shared/issueFeatures.d.ts +38 -0
  281. package/out/shared/issueFeatures.js +40 -0
  282. package/out/standalone/artifact.d.ts +6 -6
  283. package/out/standalone/baking.d.ts +2 -2
  284. package/out/standalone/combinators.d.ts +1 -1
  285. package/out/standalone/compilers.d.ts +1 -1
  286. package/out/standalone/fallbacks.d.ts +1 -1
  287. package/out/standalone/keys.d.ts +1 -1
  288. package/out/standalone/sites.d.ts +3 -3
  289. package/out/standalone/units.d.ts +1 -1
  290. package/out/standalone/values.d.ts +1 -1
  291. package/out/type.d.ts +6 -6
  292. package/out/util.d.ts +1 -0
  293. package/out/util.js +137 -0
  294. package/out/variants/array.d.ts +6 -6
  295. package/out/variants/base.d.ts +61 -10
  296. package/out/variants/date.d.ts +5 -5
  297. package/out/variants/instantiate.d.ts +1 -1
  298. package/out/variants/number.d.ts +6 -6
  299. package/out/variants/object.d.ts +25 -12
  300. package/out/variants/string.d.ts +8 -8
  301. package/package.json +183 -8
  302. package/skills/arktype/SKILL.md +93 -93
  303. package/skills/arktype/references/migrating.md +144 -158
  304. package/skills/arktype/references/precompile.md +7 -7
  305. package/out/chunk-4CUA5XIP.js +0 -7
  306. package/out/chunk-GPNK5353.js +0 -2529
  307. package/out/chunk-MLKGABMK.js +0 -9
  308. package/out/chunk-PRTMQCHS.js +0 -3
  309. package/out/chunk-R5G57XC7.js +0 -7
  310. package/out/chunk-SWOOCAHN.js +0 -4
  311. package/out/chunk-TAHPKDNM.js +0 -3
  312. package/out/chunk-UETB6YE2.js +0 -14
@@ -1,7 +1,8 @@
1
- import type { BaseMappedPropInner, OptionalMappedPropInner, Prop } from "@ark/schema";
2
- import type { arkGet, arkIndexableOf, arkKeyOf, array, ErrorType, inferred, intersectUnion, JsonStructure, Key, listable, merge, optionalKeyOf, show, toArkKey } from "@ark/util";
3
- import type { Default, required, withDefault } from "../attributes.ts";
1
+ import type { ArkEnv, BaseMappedPropInner, OptionalMappedPropInner, Prop } from "../_internal/schema/index.js";
2
+ import type { anyOrNever, arkGet, arkIndexableOf, arkKeyOf, array, ErrorType, inferred, intersectUnion, JsonStructure, Key, listable, merge, optionalKeyOf, show, toArkKey } from "../_internal/util/index.js";
3
+ import type { Default, InferredMorph, required, withDefault } from "../attributes.ts";
4
4
  import type { type } from "../keywords/keywords.ts";
5
+ import type { inferDefinition } from "../parser/definition.ts";
5
6
  import type { ArrayType } from "./array.ts";
6
7
  import type { BaseType } from "./base.ts";
7
8
  import type { instantiateType } from "./instantiate.ts";
@@ -17,9 +18,9 @@ interface Type<out t extends object = object, in out $ = {}> extends BaseType<t,
17
18
  * Get the `Type` of a property of this `Type<object>`.
18
19
  * @example type({ foo: "string" }).get("foo") // Type<string>
19
20
  */
20
- get<const k1 extends arkIndexableOf<t>, r = instantiateType<arkGet<t, k1>, $>>(k1: k1 | type.cast<k1>): r extends infer _ ? _ : never;
21
- get<const k1 extends arkIndexableOf<t>, const k2 extends arkIndexableOf<arkGet<t, k1>>, r = instantiateType<arkGet<arkGet<t, k1>, k2>, $>>(k1: k1 | type.cast<k1>, k2: k2 | type.cast<k2>): r extends infer _ ? _ : never;
22
- get<const k1 extends arkIndexableOf<t>, const k2 extends arkIndexableOf<arkGet<t, k1>>, const k3 extends arkIndexableOf<arkGet<arkGet<t, k1>, k2>>, r = instantiateType<arkGet<arkGet<arkGet<t, k1>, k2>, k3>, $>>(k1: k1 | type.cast<k1>, k2: k2 | type.cast<k2>, k3: k3 | type.cast<k3>): r extends infer _ ? _ : never;
21
+ get<const k1 extends arkIndexableOf<t>, r = instantiateType<gotAt<t, k1>, $>>(k1: k1 | type.cast<k1>): r extends infer _ ? _ : never;
22
+ get<const k1 extends arkIndexableOf<t>, const k2 extends arkIndexableOf<definedAt<t, k1>>, r = instantiateType<gotAt<definedAt<t, k1>, k2> | undefinedAt<t, k1>, $>>(k1: k1 | type.cast<k1>, k2: k2 | type.cast<k2>): r extends infer _ ? _ : never;
23
+ get<const k1 extends arkIndexableOf<t>, const k2 extends arkIndexableOf<definedAt<t, k1>>, const k3 extends arkIndexableOf<definedAt<definedAt<t, k1>, k2>>, r = instantiateType<gotAt<definedAt<definedAt<t, k1>, k2>, k3> | undefinedAt<definedAt<t, k1>, k2> | undefinedAt<t, k1>, $>>(k1: k1 | type.cast<k1>, k2: k2 | type.cast<k2>, k3: k3 | type.cast<k3>): r extends infer _ ? _ : never;
23
24
  /**
24
25
  * Create a copy of this `Type` with only the specified properties.
25
26
  *
@@ -53,7 +54,7 @@ interface Type<out t extends object = object, in out $ = {}> extends BaseType<t,
53
54
  *
54
55
  * @example type({ a: "1", b: "2" }).merge({ b: "3", c: "4" }) // Type<{ a: 1; b: 3; c: 4 }>
55
56
  */
56
- merge<const def, inferredDef = type.infer<def, $>, r = Type<merge<t, inferredDef>, $>>(def: type.validate<def, $> & (type.infer<def, $> extends object ? unknown : ErrorType<[NonObjectMergeErrorMessage, actual: inferredDef]>)): r extends infer _ ? _ : never;
57
+ merge<const def, inferredDef = inferDefinition<def, $>, r = Type<merge<t, inferredDef>, $>>(def: type.validate<def, $> & (inferDefinition<def, $> extends object ? unknown : ErrorType<[NonObjectMergeErrorMessage, actual: inferredDef]>)): r extends infer _ ? _ : never;
57
58
  /**
58
59
  * Create a copy of this `Type` with all properties required.
59
60
  *
@@ -66,7 +67,7 @@ interface Type<out t extends object = object, in out $ = {}> extends BaseType<t,
66
67
  *
67
68
  * @example const T = type({ "foo?": "string" }).required() // Type<{ foo: string }>
68
69
  */
69
- required(): Type<show<required<t>>, $>;
70
+ required(): instantiateType<show<required<t>>, $>;
70
71
  /**
71
72
  * Create a copy of this `Type` with all properties optional.
72
73
  *
@@ -79,7 +80,7 @@ interface Type<out t extends object = object, in out $ = {}> extends BaseType<t,
79
80
  *
80
81
  * @example const T = type({ foo: "string" }).partial() // Type<{ foo?: string }>
81
82
  */
82
- partial(): Type<{
83
+ partial(): instantiateType<{
83
84
  [k in keyof t]?: t[k];
84
85
  }, $>;
85
86
  /**
@@ -97,10 +98,22 @@ interface Type<out t extends object = object, in out $ = {}> extends BaseType<t,
97
98
  * List of property info of this `Type<object>`.
98
99
  * @example type({ foo: "string = 'x'" }).props // [{ kind: "optional", key: "foo", value: Type<string>, default: "x" }]
99
100
  */
100
- props: array<typePropOf<t, $>>;
101
+ props: readonly typePropOf<t, $>[];
101
102
  }
102
- type typePropOf<o, $> = o extends unknown ? keyof o extends infer k ? k extends keyof o ? typeProp<o, k, $> : never : never : never;
103
- type typeProp<o, k extends keyof o, $, t = o[k] & ({} | null)> = t extends Default<infer t, infer defaultValue> ? DefaultedTypeProp<k & Key, t, defaultValue, $> : BaseTypeProp<k extends optionalKeyOf<o> ? "optional" : "required", k & Key, t, $>;
103
+ type gotAt<o, k extends arkIndexableOf<o>> = undefaulted<arkGet<o, k>>;
104
+ type undefaulted<v> = [
105
+ v
106
+ ] extends [anyOrNever] ? v : v extends Default<infer t> ? t | undefined : v extends (...args: never) => anyOrNever ? v : v extends InferredMorph<Default<infer i, never>, infer out> ? ((In: i) => out) | undefined : v;
107
+ type definedAt<o, k extends arkIndexableOf<o>> = Exclude<gotAt<o, k>, undefined>;
108
+ type undefinedAt<o, k extends arkIndexableOf<o>> = undefined extends gotAt<o, k> ? undefined : never;
109
+ type typePropOf<o, $> = o extends unknown ? propKeyOf<o> extends infer k ? k extends keyof o ? typeProp<o, k, $> : never : never : never;
110
+ type propKeyOf<o> = o extends array ? Exclude<keyof o, keyof unknown[] | `${number}`> : keyof o;
111
+ type typeProp<o, k extends keyof o, $, v = propValueOf<o, k>> = [
112
+ v
113
+ ] extends [Default<infer t, infer defaultValue>] ? DefaultedTypeProp<k & Key, t, defaultValue, $> : [v] extends ([
114
+ InferredMorph<Default<infer i, infer defaultValue>, infer out>
115
+ ]) ? DefaultedTypeProp<k & Key, (In: i) => out, defaultValue, $> : BaseTypeProp<k extends optionalKeyOf<o> ? "optional" : "required", k & Key, v, $>;
116
+ type propValueOf<o, k extends keyof o> = k extends optionalKeyOf<o> ? Required<o>[k] : o[k];
104
117
  export interface BaseTypeProp<kind extends Prop.Kind = Prop.Kind, k extends Key = Key,
105
118
  /** @ts-ignore cast variance */
106
119
  out v = unknown, $ = {}> {
@@ -1,15 +1,15 @@
1
- import type { ExactLength, ExclusiveNumericRangeSchema, InclusiveNumericRangeSchema, Pattern } from "@ark/schema";
2
- import type { regex } from "arkregex";
1
+ import type { MessageConfig, ExactLength, ExclusiveNumericRangeSchema, InclusiveNumericRangeSchema, Pattern } from "../_internal/schema/index.js";
2
+ import type { regex } from "../_internal/regex/index.js";
3
3
  import type { BaseType } from "./base.ts";
4
4
  /** @ts-ignore cast variance */
5
5
  interface Type<out t extends string = string, in out $ = {}> extends BaseType<t, $> {
6
- matching<const schema extends Pattern.Schema>(schema: schema): schema extends string ? Type<regex.infer<schema>, $> : schema extends {
6
+ matching<const schema extends Pattern.Schema>(schema: schema, message?: MessageConfig<"pattern">): schema extends string ? Type<regex.infer<schema>, $> : schema extends {
7
7
  rule: infer pattern extends string;
8
8
  } ? Type<regex.infer<pattern>, $> : this;
9
- atLeastLength(schema: InclusiveNumericRangeSchema): this;
10
- atMostLength(schema: InclusiveNumericRangeSchema): this;
11
- moreThanLength(schema: ExclusiveNumericRangeSchema): this;
12
- lessThanLength(schema: ExclusiveNumericRangeSchema): this;
13
- exactlyLength(schema: ExactLength.Schema): this;
9
+ atLeastLength(schema: InclusiveNumericRangeSchema, message?: MessageConfig<"minLength">): this;
10
+ atMostLength(schema: InclusiveNumericRangeSchema, message?: MessageConfig<"maxLength">): this;
11
+ moreThanLength(schema: ExclusiveNumericRangeSchema, message?: MessageConfig<"minLength">): this;
12
+ lessThanLength(schema: ExclusiveNumericRangeSchema, message?: MessageConfig<"maxLength">): this;
13
+ exactlyLength(schema: ExactLength.Schema, message?: MessageConfig<"exactLength">): this;
14
14
  }
15
15
  export type { Type as StringType };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "arktype",
3
- "description": "TypeScript's 1:1 validator, optimized from editor to runtime",
3
+ "description": "TypeScript's smallest, fastest validator. One prompt away.",
4
4
  "keywords": [
5
5
  "typescript",
6
6
  "validation",
@@ -15,8 +15,8 @@
15
15
  "json-schema",
16
16
  "precompile"
17
17
  ],
18
- "version": "3.0.0-beta.1",
19
- "arkAotVersion": "0.0.1-beta.1",
18
+ "version": "3.0.0-rc.0",
19
+ "arkAotVersion": "3.0.0-rc.0",
20
20
  "license": "MIT",
21
21
  "homepage": "https://arktype.io",
22
22
  "repository": {
@@ -30,8 +30,46 @@
30
30
  "url": "https://arktype.io"
31
31
  },
32
32
  "type": "module",
33
+ "sideEffects": [
34
+ "./index.ts",
35
+ "./codecs.ts",
36
+ "./config.ts",
37
+ "./errors.ts",
38
+ "./mutatesInput.ts",
39
+ "./i18n.ts",
40
+ "./keywords/phrases.ts",
41
+ "./locales/*.ts",
42
+ "./schema.ts",
43
+ "./schemaInternal.ts",
44
+ "./internal.ts",
45
+ "./island.ts",
46
+ "./islandDependency.ts",
47
+ "./precompiled.ts",
48
+ "./runtime.ts",
49
+ "./runtimeDevelopment.ts",
50
+ "./out/index.js",
51
+ "./out/codecs.js",
52
+ "./out/config.js",
53
+ "./out/errors.js",
54
+ "./out/mutatesInput.js",
55
+ "./out/i18n.js",
56
+ "./out/keywords/phrases.js",
57
+ "./out/locales/*.js",
58
+ "./out/schema.js",
59
+ "./out/schemaInternal.js",
60
+ "./out/internal.js",
61
+ "./out/island.js",
62
+ "./out/islandDependency.js",
63
+ "./out/precompiled.js",
64
+ "./out/runtime.js",
65
+ "./out/runtimeDevelopment.js",
66
+ "./out/chunk-*.js"
67
+ ],
33
68
  "main": "./out/index.js",
34
69
  "types": "./out/index.d.ts",
70
+ "bin": {
71
+ "ark": "out/cli.js"
72
+ },
35
73
  "typesVersions": {
36
74
  "*": {
37
75
  "codecs": [
@@ -52,9 +90,36 @@
52
90
  "mutatesInput": [
53
91
  "./out/mutatesInput.d.ts"
54
92
  ],
93
+ "regex": [
94
+ "./out/regex.d.ts"
95
+ ],
55
96
  "runtime": [
56
97
  "./out/runtime.d.ts"
57
98
  ],
99
+ "schema": [
100
+ "./out/schema.d.ts"
101
+ ],
102
+ "schema/internal": [
103
+ "./out/schemaInternal.d.ts"
104
+ ],
105
+ "schema/issueFeatures": [
106
+ "./out/shared/issueFeatures.d.ts"
107
+ ],
108
+ "schema/runtime": [
109
+ "./out/schemaRuntime.d.ts"
110
+ ],
111
+ "schema/runtime/none": [
112
+ "./out/schemaRuntimeNone.d.ts"
113
+ ],
114
+ "schema/runtime/none-lean": [
115
+ "./out/schemaRuntimeNoneLean.d.ts"
116
+ ],
117
+ "schema/runtime/lean": [
118
+ "./out/schemaRuntimeLean.d.ts"
119
+ ],
120
+ "util": [
121
+ "./out/util.d.ts"
122
+ ],
58
123
  "internal": [
59
124
  "./out/internal.d.ts"
60
125
  ],
@@ -99,6 +164,10 @@
99
164
  "ark-ts": "./mutatesInput.ts",
100
165
  "default": "./out/mutatesInput.js"
101
166
  },
167
+ "./regex": {
168
+ "ark-ts": "./regex.ts",
169
+ "default": "./out/regex.js"
170
+ },
102
171
  "./runtime": {
103
172
  "ark-ts": {
104
173
  "development": "./runtimeDevelopment.ts",
@@ -107,6 +176,38 @@
107
176
  "development": "./out/runtimeDevelopment.js",
108
177
  "default": "./out/runtime.js"
109
178
  },
179
+ "./schema": {
180
+ "ark-ts": "./schema.ts",
181
+ "default": "./out/schema.js"
182
+ },
183
+ "./schema/internal": {
184
+ "ark-ts": "./schemaInternal.ts",
185
+ "default": "./out/schemaInternal.js"
186
+ },
187
+ "./schema/issueFeatures": {
188
+ "ark-ts": "./schemaIssueFeatures.ts",
189
+ "default": "./out/shared/issueFeatures.js"
190
+ },
191
+ "./schema/runtime": {
192
+ "ark-ts": "./schemaRuntime.ts",
193
+ "default": "./out/schemaRuntime.js"
194
+ },
195
+ "./schema/runtime/none": {
196
+ "ark-ts": "./schemaRuntimeNone.ts",
197
+ "default": "./out/schemaRuntimeNone.js"
198
+ },
199
+ "./schema/runtime/none-lean": {
200
+ "ark-ts": "./schemaRuntimeNoneLean.ts",
201
+ "default": "./out/schemaRuntimeNoneLean.js"
202
+ },
203
+ "./schema/runtime/lean": {
204
+ "ark-ts": "./schemaRuntimeLean.ts",
205
+ "default": "./out/schemaRuntimeLean.js"
206
+ },
207
+ "./util": {
208
+ "ark-ts": "./util.ts",
209
+ "default": "./out/util.js"
210
+ },
110
211
  "./internal": {
111
212
  "ark-ts": "./internal.ts",
112
213
  "default": "./out/internal.js"
@@ -171,6 +272,78 @@
171
272
  "types": "./out/checkers.d.ts",
172
273
  "default": "./out/runtime.js"
173
274
  },
275
+ "./internal/regex.ts": {
276
+ "ark-ts": "./regex.ts",
277
+ "default": "./out/regex.js"
278
+ },
279
+ "./internal/regex.js": {
280
+ "ark-ts": "./regex.ts",
281
+ "default": "./out/regex.js"
282
+ },
283
+ "./internal/schema.ts": {
284
+ "ark-ts": "./schema.ts",
285
+ "default": "./out/schema.js"
286
+ },
287
+ "./internal/schema.js": {
288
+ "ark-ts": "./schema.ts",
289
+ "default": "./out/schema.js"
290
+ },
291
+ "./internal/schemaInternal.ts": {
292
+ "ark-ts": "./schemaInternal.ts",
293
+ "default": "./out/schemaInternal.js"
294
+ },
295
+ "./internal/schemaInternal.js": {
296
+ "ark-ts": "./schemaInternal.ts",
297
+ "default": "./out/schemaInternal.js"
298
+ },
299
+ "./internal/schemaIssueFeatures.ts": {
300
+ "ark-ts": "./schemaIssueFeatures.ts",
301
+ "default": "./out/shared/issueFeatures.js"
302
+ },
303
+ "./internal/schemaIssueFeatures.js": {
304
+ "ark-ts": "./schemaIssueFeatures.ts",
305
+ "default": "./out/shared/issueFeatures.js"
306
+ },
307
+ "./internal/schemaRuntime.ts": {
308
+ "ark-ts": "./schemaRuntime.ts",
309
+ "default": "./out/schemaRuntime.js"
310
+ },
311
+ "./internal/schemaRuntime.js": {
312
+ "ark-ts": "./schemaRuntime.ts",
313
+ "default": "./out/schemaRuntime.js"
314
+ },
315
+ "./internal/schemaRuntimeNone.ts": {
316
+ "ark-ts": "./schemaRuntimeNone.ts",
317
+ "default": "./out/schemaRuntimeNone.js"
318
+ },
319
+ "./internal/schemaRuntimeNone.js": {
320
+ "ark-ts": "./schemaRuntimeNone.ts",
321
+ "default": "./out/schemaRuntimeNone.js"
322
+ },
323
+ "./internal/schemaRuntimeLean.ts": {
324
+ "ark-ts": "./schemaRuntimeLean.ts",
325
+ "default": "./out/schemaRuntimeLean.js"
326
+ },
327
+ "./internal/schemaRuntimeLean.js": {
328
+ "ark-ts": "./schemaRuntimeLean.ts",
329
+ "default": "./out/schemaRuntimeLean.js"
330
+ },
331
+ "./internal/schemaRuntimeNoneLean.ts": {
332
+ "ark-ts": "./schemaRuntimeNoneLean.ts",
333
+ "default": "./out/schemaRuntimeNoneLean.js"
334
+ },
335
+ "./internal/schemaRuntimeNoneLean.js": {
336
+ "ark-ts": "./schemaRuntimeNoneLean.ts",
337
+ "default": "./out/schemaRuntimeNoneLean.js"
338
+ },
339
+ "./internal/util.ts": {
340
+ "ark-ts": "./util.ts",
341
+ "default": "./out/util.js"
342
+ },
343
+ "./internal/util.js": {
344
+ "ark-ts": "./util.ts",
345
+ "default": "./out/util.js"
346
+ },
174
347
  "./internal/*.ts": {
175
348
  "ark-ts": "./*.ts",
176
349
  "types": "./out/*.d.ts",
@@ -186,10 +359,11 @@
186
359
  "out",
187
360
  "skills"
188
361
  ],
189
- "dependencies": {
190
- "@ark/util": "0.57.0-beta.1",
362
+ "devDependencies": {
363
+ "zod": "4.6.7",
364
+ "@ark/util": "3.0.0-rc.0",
191
365
  "@ark/schema": "0.57.0-beta.1",
192
- "arkregex": "0.0.16-beta.1",
366
+ "arkregex": "0.0.16-rc.0",
193
367
  "arksets": "0.0.1-beta.1"
194
368
  },
195
369
  "publishConfig": {
@@ -198,7 +372,7 @@
198
372
  "scripts": {
199
373
  "build": "ts ../repo/build.ts",
200
374
  "test": "ts ../repo/testPackage.ts; pnpm testIntegration",
201
- "testIntegration": "pnpm testSimpleConfig && pnpm testAllConfig && pnpm testOnFailConfig && pnpm testEoptConfig && pnpm testJitlessConfig && pnpm testCsp && pnpm testCspConfiguredAfterImport && pnpm testCspAfterLoad && pnpm testPrecompiled && pnpm testSchemaFirst && pnpm testConfigAfterImport && pnpm testMissingGlobals && pnpm testLocaleConfig && pnpm testLocaleWithoutIntl && pnpm testLocaleWithoutI18n && pnpm testLocaleImportedAfter",
375
+ "testIntegration": "pnpm testSimpleConfig && pnpm testAllConfig && pnpm testOnFailConfig && pnpm testEoptConfig && pnpm testJitlessConfig && pnpm testCsp && pnpm testCspConfiguredAfterImport && pnpm testCspAfterLoad && pnpm testPrecompiled && pnpm testSchemaFirst && pnpm testConfigAfterImport && pnpm testMissingGlobals && pnpm testLocaleConfig && pnpm testLocaleWithoutIntl && pnpm testLocaleWithoutI18n && pnpm testLocaleImportedAfter && pnpm testLocaleNormalizedEarly",
202
376
  "testSimpleConfig": "ts ./__tests__/integration/testSimpleConfig.ts",
203
377
  "testAllConfig": "ts ./__tests__/integration/testAllConfig.ts",
204
378
  "testOnFailConfig": "ts ./__tests__/integration/testOnFailConfig.ts",
@@ -214,6 +388,7 @@
214
388
  "testLocaleConfig": "ts ./__tests__/integration/testLocaleConfig.ts",
215
389
  "testLocaleWithoutIntl": "ts ./__tests__/integration/testLocaleWithoutIntl.ts",
216
390
  "testLocaleWithoutI18n": "ts ./__tests__/integration/testLocaleWithoutI18n.ts",
217
- "testLocaleImportedAfter": "ts ./__tests__/integration/testLocaleImportedAfter.ts"
391
+ "testLocaleImportedAfter": "ts ./__tests__/integration/testLocaleImportedAfter.ts",
392
+ "testLocaleNormalizedEarly": "ts ./__tests__/integration/testLocaleNormalizedEarly.ts"
218
393
  }
219
394
  }