+2
-2
| import type { anyOrNever, array, equals, ErrorMessage, ErrorType, optionalKeyOf, requiredKeyOf, show, unset } from "@ark/util"; | ||
| import type { distill } from "./attributes.ts"; | ||
| import type { distill, Out } from "./attributes.ts"; | ||
| import type { type } from "./keywords/keywords.ts"; | ||
@@ -14,3 +14,3 @@ import type { inferDefinition, TerminalObjectDefinition, ThunkCast } from "./parser/definition.ts"; | ||
| }; | ||
| type finalizePreinferred<preinferred, def, $, ctx extends DeclareContext> = ctx["side"] extends distill.Side ? ctx["side"] extends "in" ? (In: preinferred) => type.infer.Out<def, $> : (In: type.infer.In<def, $>) => preinferred : preinferred; | ||
| type finalizePreinferred<preinferred, def, $, ctx extends DeclareContext> = ctx["side"] extends distill.Side ? ctx["side"] extends "in" ? (In: preinferred) => type.infer.Out<def, $> : (In: type.infer.In<def, $>) => Out<preinferred> : preinferred; | ||
| export type DeclareContext = { | ||
@@ -17,0 +17,0 @@ side?: "in" | "out"; |
+10
-6
| import { Callable, throwParseError } from "@ark/util"; | ||
| export class InternalFnParser extends Callable { | ||
| constructor($) { | ||
| const attach = { | ||
| $: $, | ||
| raw: $.fn | ||
| }; | ||
| super((...signature) => { | ||
| const parse = (...signature) => { | ||
| const returnOperatorIndex = signature.indexOf(":"); | ||
@@ -22,3 +18,11 @@ const lastParamIndex = returnOperatorIndex === -1 ? | ||
| return (impl) => new InternalTypedFn(impl, paramTuple, returnType); | ||
| }, { attach }); | ||
| }; | ||
| // `raw` is an alias of `fn` itself with no type-level validation. It must | ||
| // reference `parse` directly rather than `$.fn`, which is still being | ||
| // constructed (and thus `undefined`) at this point. | ||
| const attach = { | ||
| $: $, | ||
| raw: parse | ||
| }; | ||
| super(parse, { attach }); | ||
| } | ||
@@ -25,0 +29,0 @@ } |
@@ -426,3 +426,3 @@ import { ArkErrors, intrinsic, node, rootSchema } from "@ark/schema"; | ||
| "#max": "'ffffffff-ffff-ffff-ffff-ffffffffffff'", | ||
| "#versioned": /[\da-f]{8}-[\da-f]{4}-[1-8][\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}/i, | ||
| "#versioned": /^[\da-f]{8}-[\da-f]{4}-[1-8][\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i, | ||
| v1: regexStringNode(/^[\da-f]{8}-[\da-f]{4}-1[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i, "a UUIDv1"), | ||
@@ -429,0 +429,0 @@ v2: regexStringNode(/^[\da-f]{8}-[\da-f]{4}-2[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i, "a UUIDv2"), |
+4
-4
| { | ||
| "name": "arktype", | ||
| "description": "TypeScript's 1:1 validator, optimized from editor to runtime", | ||
| "version": "2.2.2", | ||
| "version": "2.2.3", | ||
| "license": "MIT", | ||
@@ -41,5 +41,5 @@ "repository": { | ||
| "dependencies": { | ||
| "@ark/util": "0.56.1", | ||
| "arkregex": "0.0.7", | ||
| "@ark/schema": "0.56.1" | ||
| "@ark/util": "0.56.2", | ||
| "arkregex": "0.0.8", | ||
| "@ark/schema": "0.56.2" | ||
| }, | ||
@@ -46,0 +46,0 @@ "publishConfig": { |
336625
0.08%5984
0.07%+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
Updated
Updated
Updated