Socket
Socket
Sign inDemoInstall

arktype

Package Overview
Dependencies
Maintainers
1
Versions
100
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

arktype - npm Package Compare versions

Comparing version 2.0.0-beta.2 to 2.0.0-beta.3

out/ast.d.ts

22

out/ark.d.ts

@@ -1,7 +0,22 @@

import { type Ark, type ArkErrors, type inferred } from "@ark/schema";
import type { ArkErrors } from "@ark/schema";
import type { inferred } from "./ast.js";
import type { GenericHktParser } from "./generic.js";
import type { MatchParser } from "./match.js";
import type { Module } from "./module.js";
import { type arkGenericsExports } from "./keywords/arkGenerics.js";
import { type formattingExports } from "./keywords/format.js";
import { type internalExports } from "./keywords/internal.js";
import { type jsObjectExports } from "./keywords/jsObjects.js";
import { type parsingExports } from "./keywords/parsing.js";
import { type platformObjectExports } from "./keywords/platformObjects.js";
import { type tsGenericsExports } from "./keywords/tsGenerics.js";
import { type tsKeywordExports } from "./keywords/tsKeywords.js";
import { type typedArrayExports } from "./keywords/typedArray.js";
import { type validationExports } from "./keywords/validation.js";
import type { Module, Submodule } from "./module.js";
import { type Scope } from "./scope.js";
import type { DeclarationParser, DefinitionParser, TypeParser } from "./type.js";
export interface Ark extends tsKeywordExports, jsObjectExports, platformObjectExports, validationExports, tsGenericsExports, arkGenericsExports, internalExports {
TypedArray: Submodule<typedArrayExports>;
parse: Submodule<parsingExports>;
format: Submodule<formattingExports>;
}
export declare const ambient: Scope<Ark>;

@@ -17,4 +32,3 @@ export declare const ark: Module<Ark>;

export declare const generic: GenericHktParser<{}>;
export declare const match: MatchParser<{}>;
export declare const define: DefinitionParser<{}>;
export declare const declare: DeclarationParser<{}>;

@@ -1,9 +0,28 @@

import { keywordNodes } from "@ark/schema";
import { arkGenerics } from "./keywords/arkGenerics.js";
import { formatting } from "./keywords/format.js";
import { internal } from "./keywords/internal.js";
import { jsObjects } from "./keywords/jsObjects.js";
import { parsing } from "./keywords/parsing.js";
import { platformObjects } from "./keywords/platformObjects.js";
import { tsGenerics } from "./keywords/tsGenerics.js";
import { tsKeywords } from "./keywords/tsKeywords.js";
import { typedArray } from "./keywords/typedArray.js";
import { validation } from "./keywords/validation.js";
import { scope } from "./scope.js";
export const ambient = scope(keywordNodes);
export const ambient = scope({
...tsKeywords,
...jsObjects,
...platformObjects,
...validation,
...internal,
...tsGenerics,
...arkGenerics,
TypedArray: typedArray,
parse: parsing,
format: formatting
}, { prereducedAliases: true, ambient: true });
export const ark = ambient.export();
export const type = ambient.type;
export const generic = ambient.generic;
export const match = ambient.match;
export const define = ambient.define;
export const declare = ambient.declare;

@@ -0,1 +1,14 @@

import type { ArkSchemaRegistryContents } from "@ark/schema";
import type { Ark } from "./ark.js";
import type { exportScope } from "./module.js";
export * from "@ark/schema/config";
export interface ArkTypeRegistryContents extends ArkSchemaRegistryContents {
ambient: exportScope<Ark>;
}
declare global {
export interface ArkEnv {
registry(): ArkTypeRegistryContents;
}
export namespace ArkEnv {
}
}

@@ -1,2 +0,2 @@

import type { ConstrainedGenericParamDef, GenericHkt, GenericParamAst, GenericParamDef, GenericProps, GenericRoot, LazyGenericBody } from "@ark/schema";
import type { arkKind, GenericAst, GenericHkt, GenericParamAst, GenericParamDef, genericParamNames, GenericRoot, LazyGenericBody } from "@ark/schema";
import { type array, type Callable, type conform, type ErrorMessage, type ErrorType, type WhiteSpaceToken } from "@ark/util";

@@ -9,3 +9,3 @@ import type { inferDefinition } from "./parser/definition.js";

import { parseUntilFinalizer } from "./parser/string/string.js";
import type { ParseContext } from "./scope.js";
import type { ParseContext, Scope } from "./scope.js";
import type { inferTypeRoot, Type, validateTypeRoot } from "./type.js";

@@ -15,12 +15,86 @@ export type ParameterString<params extends string = string> = `<${params}>`;

export type validateParameterString<s extends ParameterString, $> = parseGenericParams<extractParams<s>, $> extends infer e extends ErrorMessage ? e : s;
export type validateGenericArg<arg, param extends GenericParamAst, $> = inferTypeRoot<arg, $> extends param[1] ? arg : ErrorType<`Invalid argument for ${param[0]}`, [expected: param[1]]>;
export type GenericInstantiator<params extends array<GenericParamAst>, def, $, args$> = <const args extends {
[i in keyof params]: validateTypeRoot<args[i & keyof args], args$>;
}>(
/** @ts-expect-error treat as array */
...args: {
[i in keyof args]: validateGenericArg<args[i], params[i & keyof params & `${number}`], args$>;
}) => Type<def extends GenericHkt ? GenericHkt.instantiate<def, {
type validateGenericArg<arg, param extends GenericParamAst, $> = inferTypeRoot<arg, $> extends param[1] ? arg : ErrorType<`Invalid argument for ${param[0]}`, [expected: param[1]]>;
export type GenericInstantiator<params extends array<GenericParamAst>, def, $, args$> = params["length"] extends 1 ? {
<const a, r = instantiateGeneric<def, params, [a], $, args$>>(a: validateTypeRoot<a, args$> & validateGenericArg<a, params[0], args$>): r;
} : params["length"] extends 2 ? {
<const a, const b, r = instantiateGeneric<def, params, [a, b], $, args$>>(...args: [validateTypeRoot<a, args$>, validateTypeRoot<b, args$>] & [
validateGenericArg<a, params[0], args$>,
validateGenericArg<b, params[1], args$>
]): r;
} : params["length"] extends 3 ? {
<const a, const b, const c, r = instantiateGeneric<def, params, [a, b, c], $, args$>>(...args: [
validateTypeRoot<a, args$>,
validateTypeRoot<b, args$>,
validateTypeRoot<c, args$>
] & [
validateGenericArg<a, params[0], args$>,
validateGenericArg<b, params[1], args$>,
validateGenericArg<c, params[2], args$>
]): r;
} : params["length"] extends 4 ? {
<const a, const b, const c, const d, r = instantiateGeneric<def, params, [a, b, c, d], $, args$>>(...args: [
validateTypeRoot<a, args$>,
validateTypeRoot<b, args$>,
validateTypeRoot<c, args$>,
validateTypeRoot<d, args$>
] & [
validateGenericArg<a, params[0], args$>,
validateGenericArg<b, params[1], args$>,
validateGenericArg<c, params[2], args$>,
validateGenericArg<d, params[3], args$>
]): r;
} : params["length"] extends 4 ? {
<const a, const b, const c, const d, const e, r = instantiateGeneric<def, params, [a, b, c, d, e], $, args$>>(...args: [
validateTypeRoot<a, args$>,
validateTypeRoot<b, args$>,
validateTypeRoot<c, args$>,
validateTypeRoot<d, args$>,
validateTypeRoot<e, args$>
] & [
validateGenericArg<a, params[0], args$>,
validateGenericArg<b, params[1], args$>,
validateGenericArg<c, params[2], args$>,
validateGenericArg<d, params[3], args$>,
validateGenericArg<e, params[4], args$>
]): r;
} : params["length"] extends 5 ? {
<const a, const b, const c, const d, const e, const f, r = instantiateGeneric<def, params, [a, b, c, d, e, f], $, args$>>(...args: [
validateTypeRoot<a, args$>,
validateTypeRoot<b, args$>,
validateTypeRoot<c, args$>,
validateTypeRoot<d, args$>,
validateTypeRoot<e, args$>,
validateTypeRoot<f, args$>
] & [
validateGenericArg<a, params[0], args$>,
validateGenericArg<b, params[1], args$>,
validateGenericArg<c, params[2], args$>,
validateGenericArg<d, params[3], args$>,
validateGenericArg<e, params[4], args$>,
validateGenericArg<f, params[5], args$>
]): r;
} : params["length"] extends 6 ? {
<const a, const b, const c, const d, const e, const f, const g, r = instantiateGeneric<def, params, [a, b, c, d, e, f, g], $, args$>>(...args: [
validateTypeRoot<a, args$>,
validateTypeRoot<b, args$>,
validateTypeRoot<c, args$>,
validateTypeRoot<d, args$>,
validateTypeRoot<e, args$>,
validateTypeRoot<f, args$>,
validateTypeRoot<g, args$>
] & [
validateGenericArg<a, params[0], args$>,
validateGenericArg<b, params[1], args$>,
validateGenericArg<c, params[2], args$>,
validateGenericArg<d, params[3], args$>,
validateGenericArg<e, params[4], args$>,
validateGenericArg<f, params[5], args$>,
validateGenericArg<g, params[6], args$>
]): r;
} : (error: ErrorMessage<`You may not define more than 7 positional generic parameters`>) => never;
type instantiateGeneric<def, params extends array<GenericParamAst>, args, $, args$> = Type<[
def
] extends [GenericHkt] ? GenericHkt.instantiate<def, {
[i in keyof args]: inferTypeRoot<args[i], args$>;
}> : inferDefinition<def, $, bindGenericArgs<params, args$, args>>, $>;
}> : inferDefinition<def, $, bindGenericArgs<params, args$, args>>, args$>;
type bindGenericArgs<params extends array<GenericParamAst>, $, args> = {

@@ -35,4 +109,16 @@ [i in keyof params & `${number}` as params[i][0]]: inferTypeRoot<args[i & keyof args], $>;

};
export interface Generic<params extends array<GenericParamAst> = array<GenericParamAst>, bodyDef = unknown, $ = {}, args$ = $> extends Callable<GenericInstantiator<params, bodyDef, $, args$>>, GenericProps<params, bodyDef, $> {
internal: GenericRoot<params, bodyDef, $>;
export interface Generic<params extends array<GenericParamAst> = array<GenericParamAst>, bodyDef = unknown, $ = {}, arg$ = $> extends Callable<GenericInstantiator<params, bodyDef, $, arg$>> {
[arkKind]: "generic";
t: GenericAst<params, bodyDef, $, arg$>;
bodyDef: bodyDef;
params: {
[i in keyof params]: [params[i][0], Type<params[i][1], $>];
};
names: genericParamNames<params>;
constraints: {
[i in keyof params]: Type<params[i][1], $>;
};
$: Scope<$>;
arg$: Scope<arg$>;
internal: GenericRoot;
}

@@ -67,9 +153,9 @@ export type GenericDeclaration<name extends string = string, params extends ParameterString = ParameterString> = `${name}${params}`;

], $>;
type genericParamDefToAst<schema extends GenericParamDef, $> = schema extends string ? [schema, unknown] : schema extends ConstrainedGenericParamDef ? [
schema[0],
inferTypeRoot<schema[1], $>
type genericParamDefToAst<schema extends GenericParamDef, $> = schema extends string ? [schema, unknown] : schema extends readonly [infer name, infer def] ? [
name,
inferTypeRoot<def, $>
] : never;
export type genericParamDefsToAst<schemas extends array<GenericParamDef>, $> = [
export type genericParamDefsToAst<defs extends array<GenericParamDef>, $> = [
...{
[i in keyof schemas]: genericParamDefToAst<schemas[i], $>;
[i in keyof defs]: genericParamDefToAst<defs[i], $>;
}

@@ -76,0 +162,0 @@ ];

8

out/index.d.ts
export { ArkError, ArkErrors, GenericHkt } from "@ark/schema";
export type { Ark, ArkConfig, Out, constrained, inferred } from "@ark/schema";
export { ambient, ark, declare, define, generic, match, type } from "./ark.js";
export type { ArkConfig, ArkScopeConfig } from "@ark/schema";
export { ambient, ark, declare, define, generic, type } from "./ark.js";
export type { Generic } from "./generic.js";
export { Module } from "./module.js";
export { Module, type Submodule } from "./module.js";
export { scope, type Scope, type inferScope, type validateScope } from "./scope.js";
export { Type, type AnyType, type inferTypeRoot, type validateTypeRoot } from "./type.js";
export { Type, type inferAmbient, type inferTypeRoot, type validateAmbient, type validateTypeRoot } from "./type.js";
export { ArkError, ArkErrors, GenericHkt } from "@ark/schema";
export { ambient, ark, declare, define, generic, match, type } from "./ark.js";
export { ambient, ark, declare, define, generic, type } from "./ark.js";
export { Module } from "./module.js";
export { scope } from "./scope.js";
export { Type } from "./type.js";

@@ -1,14 +0,22 @@

import { RootModule, type arkKind, type GenericProps } from "@ark/schema";
import { RootModule, type GenericAst, type PreparsedNodeResolution } from "@ark/schema";
import type { anyOrNever } from "@ark/util";
import type { Generic } from "./generic.js";
import type { Type } from "./type.js";
type exportScope<$> = {
[k in keyof $]: $[k] extends {
[arkKind]: "module";
} ? [
$[k]
] extends [anyOrNever] ? Type<$[k], $> : $[k] : $[k] extends GenericProps<infer params, infer bodyDef, infer args$> ? Generic<params, bodyDef, $, args$> : Type<$[k], $>;
};
export declare const Module: new <$ = {}>(types: exportScope<$>) => Module<$>;
export type Module<$ = {}> = RootModule<exportScope<$>>;
export {};
export declare const Module: new <$ extends {}>(exports: exportScope<$>) => Module<$>;
export interface Module<$ extends {} = {}> extends RootModule<exportScope<$>> {
}
export type exportScope<$> = {
[k in keyof $]: instantiateExport<$[k], $>;
} & unknown;
export declare const BoundModule: new <exports extends {}, $ extends {}>(exports: bindExportsToScope<exports, $>, $: $) => BoundModule<exports, $>;
export interface BoundModule<exports extends {}, $> extends RootModule<bindExportsToScope<exports, $>> {
}
export type bindExportsToScope<exports, $> = {
[k in keyof exports]: instantiateExport<exports[k], $>;
} & unknown;
export type Submodule<exports extends {}> = RootModule<exports>;
export type instantiateExport<t, $> = [
t
] extends [PreparsedNodeResolution] ? [
t
] extends [anyOrNever] ? Type<t, $> : t extends GenericAst<infer params, infer body, infer body$> ? Generic<params, body, body$, $> : t extends Submodule<infer exports> ? BoundModule<exports, $> : never : Type<t, $>;
import { RootModule } from "@ark/schema";
export const Module = RootModule;
export const BoundModule = RootModule;

@@ -1,4 +0,5 @@

import { type BaseRoot, type string } from "@ark/schema";
import { type ErrorMessage, type Primitive, type anyOrNever, type array, type defined, type equals, type isUnknown, type objectKindOrDomainOf, type optionalKeyOf, type requiredKeyOf, type show } from "@ark/util";
import { type BaseRoot } from "@ark/schema";
import { type ErrorMessage, type Primitive, type anyOrNever, type array, type defined, type equals, type objectKindOrDomainOf, type optionalKeyOf, type requiredKeyOf, type show } from "@ark/util";
import type { type } from "../ark.js";
import type { string } from "../ast.js";
import type { ParseContext } from "../scope.js";

@@ -12,4 +13,4 @@ import { type inferObjectLiteral, type validateObjectLiteral } from "./objectLiteral.js";

def
] extends [anyOrNever] ? def extends never ? never : any : def extends type.cast<infer t> | ThunkCast<infer t> ? t : def extends string ? inferString<def, $, args> : def extends array ? inferTuple<def, $, args> : def extends RegExp ? string.matching<string> : def extends object ? inferObjectLiteral<def, $, args> : never;
export type validateDefinition<def, $, args> = null extends undefined ? ErrorMessage<`'strict' or 'strictNullChecks' must be set to true in your tsconfig's 'compilerOptions'`> : [def] extends [Terminal] ? def : def extends string ? validateString<def, $, args> : def extends array ? validateTuple<def, $, args> : def extends BadDefinitionType ? ErrorMessage<writeBadDefinitionTypeMessage<objectKindOrDomainOf<def>>> : isUnknown<def> extends true ? BaseCompletions<$, args> | {} : validateObjectLiteral<def, $, args>;
] extends [anyOrNever] ? def : def extends type.cast<infer t> | ThunkCast<infer t> ? t : def extends string ? inferString<def, $, args> : def extends array ? inferTuple<def, $, args> : def extends RegExp ? string.matching<string> : def extends object ? inferObjectLiteral<def, $, args> : never;
export type validateDefinition<def, $, args> = null extends undefined ? ErrorMessage<`'strict' or 'strictNullChecks' must be set to true in your tsconfig's 'compilerOptions'`> : [def] extends [Terminal] ? def : def extends string ? validateString<def, $, args> : def extends array ? validateTuple<def, $, args> : def extends BadDefinitionType ? ErrorMessage<writeBadDefinitionTypeMessage<objectKindOrDomainOf<def>>> : unknown extends def ? BaseCompletions<$, args> | {} : validateObjectLiteral<def, $, args>;
export type validateDeclared<declared, def, $, args> = def extends validateDefinition<def, $, args> ? validateInference<def, declared, $, args> : validateDefinition<def, $, args>;

@@ -16,0 +17,0 @@ type validateInference<def, declared, $, args> = def extends RegExp | type.cast<unknown> | ThunkCast | TupleExpression ? validateShallowInference<def, declared, $, args> : def extends array ? declared extends array ? {

@@ -1,3 +0,4 @@

import { type BaseRoot, type Default, type IndexNode, type of, type OptionalNode, type RequiredNode, type UndeclaredKeyBehavior, type writeInvalidPropertyKeyMessage } from "@ark/schema";
import { type anyOrNever, type Dict, type ErrorMessage, type ErrorType, type EscapeToken, type Key, type listable, type merge, type show } from "@ark/util";
import { type BaseRoot, type IndexNode, type OptionalNode, type RequiredNode, type UndeclaredKeyBehavior, type writeInvalidPropertyKeyMessage } from "@ark/schema";
import { type anyOrNever, type conform, type Dict, type ErrorMessage, type ErrorType, type EscapeToken, type Key, type listable, type merge, type show } from "@ark/util";
import type { constrain, Default } from "../ast.js";
import type { ParseContext } from "../scope.js";

@@ -20,3 +21,3 @@ import type { inferDefinition, validateDefinition } from "./definition.js";

export type validateObjectLiteral<def, $, args> = {
[k in keyof def]: k extends IndexKey<infer indexDef> ? validateString<indexDef, $, args> extends ErrorMessage<infer message> ? ErrorType<message> : inferDefinition<indexDef, $, args> extends (PropertyKey | of<PropertyKey, {}>) ? validateDefinition<def[k], $, args> : ErrorType<writeInvalidPropertyKeyMessage<indexDef>> : k extends "..." ? inferDefinition<def[k], $, args> extends object ? validateDefinition<def[k], $, args> : ErrorType<writeInvalidSpreadTypeMessage<astToString<def[k]>>> : k extends "+" ? UndeclaredKeyBehavior : validateDefaultableValue<def, k, $, args>;
[k in keyof def]: k extends IndexKey<infer indexDef> ? validateString<indexDef, $, args> extends ErrorMessage<infer message> ? ErrorType<message> : inferDefinition<indexDef, $, args> extends Key | constrain<Key, {}> ? validateDefinition<def[k], $, args> : ErrorType<writeInvalidPropertyKeyMessage<indexDef>> : k extends "..." ? inferDefinition<def[k], $, args> extends object ? validateDefinition<def[k], $, args> : ErrorType<writeInvalidSpreadTypeMessage<astToString<def[k]>>> : k extends "+" ? UndeclaredKeyBehavior : validateDefaultableValue<def, k, $, args>;
};

@@ -29,7 +30,7 @@ type validateDefaultableValue<def, k extends keyof def, $, args> = def[k] extends DefaultValueTuple ? validateDefaultValueTuple<def[k], k, $, args> : validateDefinition<def[k], $, args>;

];
type validateDefaultValueTuple<def extends DefaultValueTuple, k extends PropertyKey, $, args> = parseKey<k>["kind"] extends "required" ? readonly [
type validateDefaultValueTuple<def extends DefaultValueTuple, k extends PropertyKey, $, args> = parseKey<k>["kind"] extends "required" ? conform<def, readonly [
validateDefinition<def[0], $, args>,
"=",
inferDefinition<def[0], $, args>
] : ErrorMessage<invalidDefaultKeyKindMessage>;
]> : ErrorMessage<invalidDefaultKeyKindMessage>;
type nonOptionalKeyFrom<k, $, args> = parseKey<k> extends PreparsedKey<"required", infer inner> ? inner : parseKey<k> extends PreparsedKey<"index", infer inner> ? inferDefinition<inner, $, args> extends infer t extends Key ? t : never : never;

@@ -36,0 +37,0 @@ type optionalKeyFrom<k> = parseKey<k> extends PreparsedKey<"optional", infer inner> ? inner : never;

@@ -32,3 +32,3 @@ import { ArkErrors, normalizeIndex } from "@ark/schema";

const structureNode = ctx.$.node("structure", structure);
return ctx.$.schema({
return ctx.$.rootNode({
domain: "object",

@@ -72,3 +72,3 @@ structure: spread?.merge(structureNode) ?? structureNode

: normalized.index
: normalized.required ?? []);
: (normalized.required ?? []));
}

@@ -75,0 +75,0 @@ return ctx.$.node(parsedKey.kind, {

@@ -1,3 +0,4 @@

import type { LimitLiteral, writeUnboundableMessage } from "@ark/schema";
import type { writeUnboundableMessage } from "@ark/schema";
import type { ErrorMessage, array, typeToString } from "@ark/util";
import type { LimitLiteral } from "../../ast.js";
import type { Comparator } from "../string/reduce/shared.js";

@@ -4,0 +5,0 @@ import type { BoundExpressionKind, writeInvalidLimitMessage } from "../string/shift/operator/bounds.js";

@@ -1,2 +0,2 @@

import type { SchemaRoot, writeIndivisibleMessage } from "@ark/schema";
import type { writeIndivisibleMessage } from "@ark/schema";
import type { ErrorMessage } from "@ark/util";

@@ -7,2 +7,2 @@ import type { inferAstIn } from "./infer.js";

data
] extends [number] ? validateAst<l, $, args> : ErrorMessage<writeIndivisibleMessage<SchemaRoot<data>>> : never;
] extends [number] ? validateAst<l, $, args> : ErrorMessage<writeIndivisibleMessage<data>> : never;

@@ -1,3 +0,6 @@

import type { Date, DateLiteral, Default, GenericHkt, GenericProps, LimitLiteral, RegexLiteral, constrain, distillIn, distillOut, inferIntersection, normalizeLimit, string } from "@ark/schema";
import type { GenericAst, GenericHkt } from "@ark/schema";
import type { BigintLiteral, array } from "@ark/util";
import type { Ark } from "../../ark.js";
import type { Date, DateLiteral, Default, LimitLiteral, RegexLiteral, applyConstraint, distillIn, distillOut, normalizeLimit, string } from "../../ast.js";
import type { inferIntersection } from "../../intersect.js";
import type { UnparsedScope, resolve, tryInferSubmoduleReference } from "../../scope.js";

@@ -11,9 +14,10 @@ import type { inferDefinition } from "../definition.js";

export type inferConstrainableAst<ast, $, args> = ast extends array ? inferExpression<ast, $, args> : ast extends string ? inferTerminal<ast, $, args> : never;
export type GenericInstantiationAst<generic extends GenericProps = GenericProps, argAsts extends unknown[] = unknown[]> = [generic, "<>", argAsts];
export type inferExpression<ast extends array, $, args> = ast extends GenericInstantiationAst<infer generic, infer argAsts> ? generic["bodyDef"] extends GenericHkt ? GenericHkt.instantiate<generic["bodyDef"], {
export type GenericInstantiationAst<generic extends GenericAst = GenericAst, argAsts extends unknown[] = unknown[]> = [generic, "<>", argAsts];
type resolveScope<g$, $> = g$ extends UnparsedScope ? $ : g$;
export type inferExpression<ast extends array, $, args> = ast extends GenericInstantiationAst<infer g, infer argAsts> ? g["bodyDef"] extends GenericHkt ? GenericHkt.instantiate<g["bodyDef"], {
[i in keyof argAsts]: inferConstrainableAst<argAsts[i], $, args>;
}> : inferDefinition<generic["bodyDef"], generic["$"]["t"] extends UnparsedScope ? $ : generic["$"]["t"], {
[i in keyof generic["params"] & `${number}` as generic["names"][i & keyof generic["names"]]]: inferConstrainableAst<argAsts[i & keyof argAsts], $, args>;
}> : ast[1] extends "[]" ? inferConstrainableAst<ast[0], $, args>[] : ast[1] extends "|" ? inferConstrainableAst<ast[0], $, args> | inferConstrainableAst<ast[2], $, args> : ast[1] extends "&" ? inferIntersection<inferConstrainableAst<ast[0], $, args>, inferConstrainableAst<ast[2], $, args>> : ast[1] extends "=" ? inferTerminal<ast[2] & string, $, args> extends infer defaultValue ? (In?: inferConstrainableAst<ast[0], $, args>) => Default<defaultValue> : never : ast[1] extends Comparator ? ast[0] extends LimitLiteral ? constrainBound<inferConstrainableAst<ast[2], $, args>, ast[1], ast[0]> : constrainBound<inferConstrainableAst<ast[0], $, args>, ast[1], ast[2]> : ast[1] extends "%" ? constrain<inferConstrainableAst<ast[0], $, args>, "divisor", ast[2] & number> : ast[0] extends "keyof" ? keyof inferConstrainableAst<ast[1], $, args> : never;
export type constrainBound<constrainableIn, comparator extends Comparator, limit> = distillIn<constrainableIn> extends infer In ? comparator extends "==" ? In extends number ? limit : In extends Date ? Date.literal<normalizeLimit<limit>> : constrain<constrainableIn, "exactLength", limit & number> : constrain<constrainableIn, In extends number ? comparator extends MinComparator ? "min" : "max" : In extends string | array ? comparator extends MinComparator ? "minLength" : "maxLength" : comparator extends MinComparator ? "after" : "before", {
}> : inferDefinition<g["bodyDef"], resolveScope<g["$"], $>, {
[i in keyof g["names"] & `${number}` as g["names"][i]]: inferConstrainableAst<argAsts[i & keyof argAsts], resolveScope<g["arg$"], $>, args>;
}> : ast[1] extends "[]" ? inferConstrainableAst<ast[0], $, args>[] : ast[1] extends "|" ? inferConstrainableAst<ast[0], $, args> | inferConstrainableAst<ast[2], $, args> : ast[1] extends "&" ? inferIntersection<inferConstrainableAst<ast[0], $, args>, inferConstrainableAst<ast[2], $, args>> : ast[1] extends "=" ? inferTerminal<ast[2] & string, $, args> extends infer defaultValue ? (In?: inferConstrainableAst<ast[0], $, args>) => Default<defaultValue> : never : ast[1] extends Comparator ? ast[0] extends LimitLiteral ? constrainBound<inferConstrainableAst<ast[2], $, args>, ast[1], ast[0]> : constrainBound<inferConstrainableAst<ast[0], $, args>, ast[1], ast[2]> : ast[1] extends "%" ? applyConstraint<inferConstrainableAst<ast[0], $, args>, "divisor", ast[2] & number> : ast[0] extends "keyof" ? keyof inferConstrainableAst<ast[1], $, args> : never;
export type constrainBound<constrainableIn, comparator extends Comparator, limit> = distillIn<constrainableIn> extends infer In ? comparator extends "==" ? In extends number ? limit : In extends Date ? Date.literal<normalizeLimit<limit>> : applyConstraint<constrainableIn, "exactLength", limit & number> : applyConstraint<constrainableIn, In extends number ? comparator extends MinComparator ? "min" : "max" : In extends string | array ? comparator extends MinComparator ? "minLength" : "maxLength" : comparator extends MinComparator ? "after" : "before", {
rule: normalizeLimit<limit>;

@@ -28,2 +32,3 @@ exclusive: comparator extends ">" | "<" ? true : false;

export type InfixExpression<operator extends InfixOperator = InfixOperator, l = unknown, r = unknown> = [l, operator, r];
export type inferTerminal<token extends string, $, args> = token extends keyof args | keyof $ ? resolve<token, $, args> : token extends keyof ArkEnv.$ ? ArkEnv.$[token] : `#${token}` extends keyof $ ? resolve<`#${token}`, $, args> : token extends StringLiteral<infer text> ? text : token extends `${infer n extends number}` ? n : token extends BigintLiteral<infer b> ? b : token extends RegexLiteral<infer source> ? string.matching<source> : token extends DateLiteral<infer source> ? Date.literal<source> : tryInferSubmoduleReference<$, token>;
export type inferTerminal<token extends string, $, args> = token extends keyof args | keyof $ ? resolve<token, $, args> : token extends keyof Ark ? Ark[token] : `#${token}` extends keyof $ ? resolve<`#${token}`, $, args> : token extends StringLiteral<infer text> ? text : token extends `${infer n extends number}` ? n : token extends BigintLiteral<infer b> ? b : token extends RegexLiteral<infer source> ? string.matching<source> : token extends DateLiteral<infer source> ? Date.literal<source> : tryInferSubmoduleReference<$, token>;
export {};

@@ -1,2 +0,2 @@

import type { arkKind, GenericParamAst, GenericProps, PrivateDeclaration, writeMissingSubmoduleAccessMessage, writeUnsatisfiedParameterConstraintMessage } from "@ark/schema";
import type { arkKind, GenericParamAst, PrivateDeclaration, writeMissingSubmoduleAccessMessage, writeUnsatisfiedParameterConstraintMessage } from "@ark/schema";
import type { anyOrNever, array, BigintLiteral, charsAfterFirst, Completion, ErrorMessage, typeToString, writeMalformedNumericLiteralMessage } from "@ark/util";

@@ -12,4 +12,5 @@ import type { Generic } from "../../generic.js";

import type { GenericInstantiationAst, inferAstRoot, InfixExpression, PostfixExpression } from "./infer.js";
import type { validateKeyof } from "./keyof.js";
import type { astToString } from "./utils.js";
export type validateAst<ast, $, args> = ast extends string ? validateStringAst<ast, $> : ast extends PostfixExpression<infer operator, infer operand> ? operator extends "[]" ? validateAst<operand, $, args> : never : ast extends InfixExpression<infer operator, infer l, infer r> ? operator extends "&" | "|" ? validateInfix<ast, $, args> : operator extends Comparator ? validateRange<l, operator, r, $, args> : operator extends "%" ? validateDivisor<l, $, args> : undefined : ast extends (readonly [infer baseAst, "=", infer unitLiteral extends UnitLiteral]) ? validateDefault<baseAst, unitLiteral, $, args> : ast extends readonly ["keyof", infer operand] ? validateAst<operand, $, args> : ast extends (GenericInstantiationAst<Generic<infer params, any, any> | GenericProps<infer params>, infer argAsts>) ? validateGenericArgs<params, argAsts, $, args, []> : ErrorMessage<writeUnexpectedExpressionMessage<astToString<ast>>> & {
export type validateAst<ast, $, args> = ast extends string ? validateStringAst<ast, $> : ast extends PostfixExpression<infer operator, infer operand> ? operator extends "[]" ? validateAst<operand, $, args> : never : ast extends InfixExpression<infer operator, infer l, infer r> ? operator extends "&" | "|" ? validateInfix<ast, $, args> : operator extends Comparator ? validateRange<l, operator, r, $, args> : operator extends "%" ? validateDivisor<l, $, args> : undefined : ast extends [infer baseAst, "=", infer unitLiteral extends UnitLiteral] ? validateDefault<baseAst, unitLiteral, $, args> : ast extends ["keyof", infer operand] ? validateKeyof<operand, $, args> : ast extends GenericInstantiationAst<infer g, infer argAsts> ? validateGenericArgs<g["paramsAst"], argAsts, $, args, []> : ErrorMessage<writeUnexpectedExpressionMessage<astToString<ast>>> & {
ast: ast;

@@ -19,4 +20,2 @@ };

type validateGenericArgs<params extends array<GenericParamAst>, argAsts extends array, $, args, indices extends 1[]> = argAsts extends readonly [infer arg, ...infer argsTail] ? validateAst<arg, $, args> extends infer e extends ErrorMessage ? e : inferAstRoot<arg, $, args> extends params[indices["length"]][1] ? validateGenericArgs<params, argsTail, $, args, [...indices, 1]> : ErrorMessage<writeUnsatisfiedParameterConstraintMessage<params[indices["length"]][0], typeToString<params[indices["length"]][1]>, astToString<arg>>> : undefined;
export declare const writeUnsatisfiableExpressionError: <expression extends string>(expression: expression) => writeUnsatisfiableExpressionError<expression>;
export type writeUnsatisfiableExpressionError<expression extends string> = `${expression} results in an unsatisfiable type`;
export declare const writePrefixedPrivateReferenceMessage: <def extends PrivateDeclaration>(def: def) => writePrefixedPrivateReferenceMessage<def>;

@@ -26,3 +25,3 @@ export type writePrefixedPrivateReferenceMessage<def extends PrivateDeclaration> = `Private type references should not include '#'. Use '${charsAfterFirst<def>}' instead.`;

$[alias]
] extends [anyOrNever] ? def : def extends PrivateDeclaration ? ErrorMessage<writePrefixedPrivateReferenceMessage<def>> : $[alias] extends GenericProps ? ErrorMessage<writeInvalidGenericArgCountMessage<def, $[alias]["names"], []>> : $[alias] extends {
] extends [anyOrNever] ? def : def extends PrivateDeclaration ? ErrorMessage<writePrefixedPrivateReferenceMessage<def>> : $[alias] extends Generic ? ErrorMessage<writeInvalidGenericArgCountMessage<def, $[alias]["names"], []>> : $[alias] extends {
[arkKind]: "module";

@@ -29,0 +28,0 @@ } ? ErrorMessage<writeMissingSubmoduleAccessMessage<def>> : undefined : def extends ErrorMessage ? def : undefined;

@@ -1,2 +0,1 @@

export const writeUnsatisfiableExpressionError = (expression) => `${expression} results in an unsatisfiable type`;
export const writePrefixedPrivateReferenceMessage = (def) => `Private type references should not include '#'. Use '${def.slice(1)}' instead.`;

@@ -1,3 +0,4 @@

import type { BaseRoot, LimitLiteral } from "@ark/schema";
import type { BaseRoot } from "@ark/schema";
import { type requireKeys } from "@ark/util";
import type { LimitLiteral } from "../../../ast.js";
import type { ParseContext } from "../../../scope.js";

@@ -4,0 +5,0 @@ import type { InfixOperator } from "../../semantic/infer.js";

@@ -1,2 +0,2 @@

import type { LimitLiteral } from "@ark/schema";
import type { LimitLiteral } from "../../../ast.js";
export type StringifiablePrefixOperator = "keyof";

@@ -3,0 +3,0 @@ export declare const minComparators: {

@@ -1,3 +0,3 @@

import type { LimitLiteral } from "@ark/schema";
import type { Completion, ErrorMessage, defined } from "@ark/util";
import type { LimitLiteral } from "../../../ast.js";
import type { Scanner } from "../shift/scanner.js";

@@ -4,0 +4,0 @@ import type { Comparator, InvertedComparators, MaxComparator, MinComparator, OpenLeftBound, StringifiablePrefixOperator, writeMultipleLeftBoundsMessage, writeOpenRangeMessage, writeUnclosedGroupMessage, writeUnmatchedGroupCloseMessage, writeUnpairableComparatorMessage } from "./shared.js";

@@ -1,2 +0,2 @@

import type { DateLiteral } from "@ark/schema";
import type { DateLiteral } from "../../../../ast.js";
export declare const isDateLiteral: (value: unknown) => value is DateLiteral;

@@ -3,0 +3,0 @@ export declare const isValidDate: (d: Date) => boolean;

@@ -1,2 +0,2 @@

import type { BaseRoot, GenericProps, GenericRoot } from "@ark/schema";
import type { BaseRoot, GenericAst, genericParamNames, GenericRoot } from "@ark/schema";
import type { array, ErrorMessage, join } from "@ark/util";

@@ -8,3 +8,3 @@ import type { DynamicState } from "../../reduce/dynamic.js";

export declare const parseGenericArgs: (name: string, g: GenericRoot, s: DynamicState) => BaseRoot[];
export type parseGenericArgs<name extends string, g extends GenericProps, unscanned extends string, $, args> = _parseGenericArgs<name, g, unscanned, $, args, [], []>;
export type parseGenericArgs<name extends string, g extends GenericAst, unscanned extends string, $, args> = _parseGenericArgs<name, g, unscanned, $, args, [], []>;
declare const _parseGenericArgs: (name: string, g: GenericRoot, s: DynamicState, argNodes: BaseRoot[]) => BaseRoot[];

@@ -15,3 +15,3 @@ export type ParsedArgs<result extends unknown[] = unknown[], unscanned extends string = string> = {

};
type _parseGenericArgs<name extends string, g extends GenericProps, unscanned extends string, $, args, argDefs extends string[], argAsts extends unknown[]> = parseUntilFinalizer<state.initialize<unscanned>, $, args> extends (infer finalArgState extends StaticState) ? {
type _parseGenericArgs<name extends string, g extends GenericAst, unscanned extends string, $, args, argDefs extends string[], argAsts extends unknown[]> = parseUntilFinalizer<state.initialize<unscanned>, $, args> extends (infer finalArgState extends StaticState) ? {
defs: [

@@ -27,5 +27,5 @@ ...argDefs,

unscanned: infer nextUnscanned extends string;
}) ? finalArgState["finalizer"] extends ">" ? nextAsts["length"] extends g["params"]["length"] ? ParsedArgs<nextAsts, nextUnscanned> : state.error<writeInvalidGenericArgCountMessage<name, g["names"], nextDefs>> : finalArgState["finalizer"] extends "," ? _parseGenericArgs<name, g, nextUnscanned, $, args, nextDefs, nextAsts> : finalArgState["finalizer"] extends ErrorMessage ? finalArgState : state.error<writeUnclosedGroupMessage<">">> : never : never;
}) ? finalArgState["finalizer"] extends ">" ? nextAsts["length"] extends g["paramsAst"]["length"] ? ParsedArgs<nextAsts, nextUnscanned> : state.error<writeInvalidGenericArgCountMessage<name, genericParamNames<g["paramsAst"]>, nextDefs>> : finalArgState["finalizer"] extends "," ? _parseGenericArgs<name, g, nextUnscanned, $, args, nextDefs, nextAsts> : finalArgState["finalizer"] extends ErrorMessage ? finalArgState : state.error<writeUnclosedGroupMessage<">">> : never : never;
export declare const writeInvalidGenericArgCountMessage: <name extends string, params extends array<string>, argDefs extends array<string>>(name: name, params: params, argDefs: argDefs) => writeInvalidGenericArgCountMessage<name, params, argDefs>;
export type writeInvalidGenericArgCountMessage<name extends string, params extends array<string>, argDefs extends array<string>> = `${name}<${join<params, ", ">}> requires exactly ${params["length"]} args (got ${argDefs["length"]}${argDefs["length"] extends (0) ? "" : `: ${join<argDefs, ",">}`})`;
export {};

@@ -1,3 +0,4 @@

import { BaseRoot, writeUnresolvableMessage, type GenericProps, type GenericRoot, type arkKind, type resolvableReferenceIn, type resolveReference, type writeNonSubmoduleDotMessage } from "@ark/schema";
import { BaseRoot, writeUnresolvableMessage, type GenericAst, type GenericRoot, type arkKind, type genericParamNames, type resolvableReferenceIn, type resolveReference, type writeNonSubmoduleDotMessage } from "@ark/schema";
import { type BigintLiteral, type Completion, type ErrorMessage, type anyOrNever, type join } from "@ark/util";
import type { Ark } from "../../../../ark.js";
import type { GenericInstantiationAst } from "../../../semantic/infer.js";

@@ -10,12 +11,16 @@ import type { DynamicState } from "../../reduce/dynamic.js";

export declare const parseUnenclosed: (s: DynamicState) => void;
export type parseUnenclosed<s extends StaticState, $, args> = Scanner.shiftUntilNextTerminator<s["unscanned"]> extends (Scanner.shiftResult<infer token, infer unscanned>) ? token extends "keyof" ? state.addPrefix<s, "keyof", unscanned> : tryResolve<s, token, $, args> extends infer result ? result extends ErrorMessage<infer message> ? state.error<message> : result extends resolvableReferenceIn<$> ? parseResolution<s, unscanned, result, resolveReference<result, $>, $, args> : result extends resolvableReferenceIn<ArkEnv.$> ? parseResolution<s, unscanned, result, resolveReference<result, ArkEnv.$>, $, args> : state.setRoot<s, result, unscanned> : never : never;
export type parseUnenclosed<s extends StaticState, $, args> = Scanner.shiftUntilNextTerminator<s["unscanned"]> extends (Scanner.shiftResult<infer token, infer unscanned>) ? token extends "keyof" ? state.addPrefix<s, "keyof", unscanned> : tryResolve<s, token, $, args> extends infer result ? result extends ErrorMessage<infer message> ? state.error<message> : result extends resolvableReferenceIn<$> ? parseResolution<s, unscanned, result, resolveReference<result, $>, $, args> : result extends resolvableReferenceIn<Ark> ? parseResolution<s, unscanned, result, resolveReference<result, Ark>, $, args> : state.setRoot<s, result, unscanned> : never : never;
type parseResolution<s extends StaticState, unscanned extends string, alias extends string, resolution, $, args> = [
resolution
] extends [anyOrNever] ? state.setRoot<s, alias, unscanned> : resolution extends GenericProps ? parseGenericInstantiation<alias, resolution, state.scanTo<s, unscanned>, $, args> : state.setRoot<s, alias, unscanned>;
] extends [anyOrNever] ? state.setRoot<s, alias, unscanned> : resolution extends GenericAst ? parseGenericInstantiation<alias, resolution, state.scanTo<s, unscanned>, $, args> : state.setRoot<s, alias, unscanned>;
export declare const parseGenericInstantiation: (name: string, g: GenericRoot, s: DynamicState) => BaseRoot;
export type parseGenericInstantiation<name extends string, g extends GenericProps, s extends StaticState, $, args> = Scanner.skipWhitespace<s["unscanned"]> extends `<${infer unscanned}` ? parseGenericArgs<name, g, unscanned, $, args> extends infer result ? result extends ParsedArgs<infer argAsts, infer nextUnscanned> ? state.setRoot<s, GenericInstantiationAst<g, argAsts>, nextUnscanned> : result : never : state.error<writeInvalidGenericArgCountMessage<name, g["names"], []>>;
type tryResolve<s extends StaticState, token extends string, $, args> = token extends keyof ArkEnv.$ ? token : token extends keyof $ ? token : `#${token}` extends keyof $ ? token : token extends keyof args ? token : token extends `${number}` ? token : token extends BigintLiteral ? token : token extends (`${infer submodule extends (keyof $ | keyof ArkEnv.$) & string}.${infer reference}`) ? tryResolveSubmodule<token, submodule, reference, s, $ & ArkEnv.$, args> : unresolvableError<s, token, $, args, []>;
type tryResolveSubmodule<token, submodule extends keyof $ & string, reference extends string, s extends StaticState, $, args> = $[submodule] extends {
export type parseGenericInstantiation<name extends string, g extends GenericAst, s extends StaticState, $, args> = Scanner.skipWhitespace<s["unscanned"]> extends `<${infer unscanned}` ? parseGenericArgs<name, g, unscanned, $, args> extends infer result ? result extends ParsedArgs<infer argAsts, infer nextUnscanned> ? state.setRoot<s, GenericInstantiationAst<g, argAsts>, nextUnscanned> : result : never : state.error<writeInvalidGenericArgCountMessage<name, genericParamNames<g["paramsAst"]>, [
]>>;
type tryResolve<s extends StaticState, token extends string, $, args> = token extends keyof Ark ? token : token extends keyof $ ? token : `#${token}` extends keyof $ ? token : token extends keyof args ? token : token extends `${number}` ? token : token extends BigintLiteral ? token : token extends (`${infer submodule extends (keyof $ | keyof Ark) & string}.${infer reference}`) ? tryResolveSubmodule<token, submodule, reference, s, $ & Ark, [submodule]> : unresolvableError<s, token, $, args, []>;
type tryResolveSubmodule<token, submodule extends keyof $ & string, reference extends string, s extends StaticState, $, submodulePath extends string[]> = $[submodule] extends {
[arkKind]: "module";
} ? reference extends keyof $[submodule] ? token : unresolvableError<s, reference, $[submodule], args, [submodule]> : ErrorMessage<writeNonSubmoduleDotMessage<submodule>>;
} ? reference extends keyof $[submodule] ? token : reference extends (`${infer nestedSubmodule extends keyof $[submodule] & string}.${infer nestedReference}`) ? tryResolveSubmodule<token, nestedSubmodule, nestedReference, s, $[submodule], [
...submodulePath,
nestedSubmodule
]> : unresolvableError<s, reference, $[submodule], {}, submodulePath> : ErrorMessage<writeNonSubmoduleDotMessage<submodule>>;
/** Provide valid completions for the current token, or fallback to an

@@ -25,3 +30,3 @@ * unresolvable error if there are none */

type qualifiedReference<reference extends string, submodulePath extends string[]> = join<[...submodulePath, reference], ".">;
type validReferenceFromToken<token extends string, $, args, submodulePath extends string[]> = Extract<submodulePath extends [] ? BaseCompletions<$, args> : keyof $, `${token}${string}`>;
type validReferenceFromToken<token extends string, $, args, submodulePath extends string[]> = Extract<submodulePath["length"] extends 0 ? BaseCompletions<$, args> : resolvableReferenceIn<$>, `${token}${string}`>;
export declare const writeMissingOperandMessage: (s: DynamicState) => string;

@@ -28,0 +33,0 @@ export type writeMissingRightOperandMessage<token extends string, unscanned extends string = ""> = `Token '${token}' requires a right operand${unscanned extends "" ? "" : ` before '${unscanned}'`}`;

@@ -1,3 +0,4 @@

import { type BaseRoot, type BoundKind, type LimitLiteral } from "@ark/schema";
import { type BaseRoot, type BoundKind } from "@ark/schema";
import { type keySet } from "@ark/util";
import type { LimitLiteral } from "../../../../ast.js";
import type { astToString } from "../../../semantic/utils.js";

@@ -4,0 +5,0 @@ import type { DynamicState, DynamicStateWithRoot } from "../../reduce/dynamic.js";

@@ -1,3 +0,3 @@

import { internal, jsObjects, tsKeywords, writeUnboundableMessage } from "@ark/schema";
import { isKeyOf, throwParseError } from "@ark/util";
import { writeUnboundableMessage } from "@ark/schema";
import { $ark, isKeyOf, throwParseError } from "@ark/util";
import { invertedComparators, maxComparators, writeUnpairableComparatorMessage } from "../../reduce/shared.js";

@@ -36,3 +36,3 @@ import { extractDateLiteralSource, isDateLiteral } from "../operand/date.js";

export const getBoundKinds = (comparator, limit, root, boundKind) => {
if (root.extends(tsKeywords.number)) {
if (root.extends($ark.intrinsic.number)) {
if (typeof limit !== "number") {

@@ -45,3 +45,3 @@ return throwParseError(writeInvalidLimitMessage(comparator, limit, boundKind));

}
if (root.extends(internal.lengthBoundable)) {
if (root.extends($ark.intrinsic.lengthBoundable)) {
if (typeof limit !== "number") {

@@ -54,3 +54,3 @@ return throwParseError(writeInvalidLimitMessage(comparator, limit, boundKind));

}
if (root.extends(jsObjects.Date)) {
if (root.extends($ark.intrinsic.Date)) {
// allow either numeric or date limits

@@ -57,0 +57,0 @@ return (comparator === "==" ? ["after", "before"]

@@ -1,3 +0,4 @@

import type { BaseRoot, DateLiteral } from "@ark/schema";
import type { BaseRoot } from "@ark/schema";
import { type BigintLiteral, type ErrorMessage, type NumberLiteral, type trim } from "@ark/util";
import type { DateLiteral } from "../../../../ast.js";
import type { DynamicStateWithRoot } from "../../reduce/dynamic.js";

@@ -4,0 +5,0 @@ import type { StringLiteral } from "../operand/enclosed.js";

import type { BaseRoot, resolvableReferenceIn } from "@ark/schema";
import { type ErrorMessage } from "@ark/util";
import type { Ark } from "../../ark.js";
import type { inferAstRoot } from "../semantic/infer.js";

@@ -19,3 +20,3 @@ import type { DynamicState, DynamicStateWithRoot } from "./reduce/dynamic.js";

export type inferString<def extends string, $, args> = inferAstRoot<parseString<def, $, args>, $, args>;
export type BaseCompletions<$, args, otherSuggestions extends string = never> = resolvableReferenceIn<$> | resolvableReferenceIn<ArkEnv.$> | (keyof args & string) | StringifiablePrefixOperator | otherSuggestions;
export type BaseCompletions<$, args, otherSuggestions extends string = never> = resolvableReferenceIn<$> | resolvableReferenceIn<Ark> | (keyof args & string) | StringifiablePrefixOperator | otherSuggestions;
export type StringParseResult = BaseRoot | ParsedDefault;

@@ -22,0 +23,0 @@ export declare const fullStringParse: (s: DynamicState) => StringParseResult;

@@ -1,3 +0,5 @@

import { type BaseMeta, type BaseRoot, type Morph, type Out, type Predicate, type distillConstrainableIn, type distillOut, type inferIntersection, type inferMorphOut, type inferPredicate } from "@ark/schema";
import { type BuiltinObjectKind, type Constructor, type Domain, type ErrorMessage, type array, type conform, type show } from "@ark/util";
import { type BaseMeta, type BaseRoot, type Morph, type Predicate } from "@ark/schema";
import { type array, type BuiltinObjectKind, type conform, type Constructor, type Domain, type ErrorMessage, type show } from "@ark/util";
import type { distillConstrainableIn, distillOut, inferMorphOut, inferPredicate, Out } from "../ast.js";
import type { inferIntersection } from "../intersect.js";
import type { ParseContext } from "../scope.js";

@@ -4,0 +6,0 @@ import type { inferDefinition, validateDefinition } from "./definition.js";

@@ -1,3 +0,3 @@

import { jsObjects, makeRootAndArrayPropertiesMutable, tsKeywords } from "@ark/schema";
import { append, objectKindOrDomainOf, throwParseError } from "@ark/util";
import { makeRootAndArrayPropertiesMutable } from "@ark/schema";
import { $ark, append, objectKindOrDomainOf, throwParseError } from "@ark/util";
import { writeMissingRightOperandMessage } from "./string/shift/operand/unenclosed.js";

@@ -24,3 +24,3 @@ export const parseTuple = (def, ctx) => maybeParseTupleExpression(def, ctx) ?? parseTupleLiteral(def, ctx);

if (spread) {
if (!element.extends(jsObjects.Array))
if (!element.extends($ark.intrinsic.Array))
return throwParseError(writeNonArraySpreadMessage(element.expression));

@@ -32,3 +32,3 @@ // a spread must be distributed over branches e.g.:

// since appendElement mutates base, we have to shallow-ish clone it for each branch
element.branches.map(branch => appendSpreadBranch(makeRootAndArrayPropertiesMutable(base), branch)));
element.distribute(branch => appendSpreadBranch(makeRootAndArrayPropertiesMutable(base), branch)));
}

@@ -39,3 +39,3 @@ else {

}
return ctx.$.internal.schema(sequences.map(sequence => ({
return ctx.$.internal.rootNode(sequences.map(sequence => ({
proto: Array,

@@ -90,3 +90,3 @@ sequence

// the only array with no sequence reference is unknown[]
return appendElement(base, "variadic", tsKeywords.unknown.internal);
return appendElement(base, "variadic", $ark.intrinsic.unknown);
}

@@ -93,0 +93,0 @@ spread.prefix.forEach(node => appendElement(base, "required", node));

@@ -1,12 +0,12 @@

import { InternalBaseScope, type AliasDefEntry, type ArkConfig, type BaseRoot, type BaseScope, type GenericArgResolutions, type GenericParamAst, type GenericParamDef, type GenericProps, type InternalResolutions, type PreparsedNodeResolution, type PrivateDeclaration, type arkKind, type destructuredExportContext, type destructuredImportContext, type exportedNameOf, type writeDuplicateAliasError } from "@ark/schema";
import { type ErrorType, type anyOrNever, type array, type nominal, type show } from "@ark/util";
import { parseGenericParams, type Generic, type GenericDeclaration, type GenericHktParser, type ParameterString, type baseGenericConstraints, type parseValidGenericParams } from "./generic.js";
import { type MatchParser } from "./match.js";
import type { Module } from "./module.js";
import { BaseScope, type AliasDefEntry, type ArkScopeConfig, type BaseNode, type BaseRoot, type GenericArgResolutions, type GenericAst, type GenericParamAst, type InternalResolutions, type Node, type NodeKind, type NodeParseOptions, type NodeSchema, type PreparsedNodeResolution, type PrivateDeclaration, type RootKind, type RootSchema, type arkKind, type destructuredExportContext, type destructuredImportContext, type exportedNameOf, type reducibleKindOf, type toInternalScope, type writeDuplicateAliasError } from "@ark/schema";
import { type ErrorType, type Json, type anyOrNever, type array, type flattenListable, type nominal, type show } from "@ark/util";
import type { Ark } from "./ark.js";
import { parseGenericParams, type GenericDeclaration, type GenericHktParser, type ParameterString, type baseGenericConstraints, type parseValidGenericParams } from "./generic.js";
import type { BoundModule, Module, Submodule, instantiateExport } from "./module.js";
import { type inferDefinition, type validateDefinition } from "./parser/definition.js";
import type { ParsedDefault } from "./parser/string/shift/operator/default.js";
import { InternalTypeParser, type DeclarationParser, type DefinitionParser, type Type, type TypeParser } from "./type.js";
export type ScopeParser = <const def>(def: validateScope<def>, config?: ArkConfig) => Scope<inferScope<def>>;
export type ScopeParser = <const def>(def: validateScope<def>, config?: ArkScopeConfig) => Scope<inferScope<def>>;
export type validateScope<def> = {
[k in keyof def]: k extends symbol ? unknown : parseScopeKey<k, def>["params"] extends infer params ? params extends array<GenericParamAst> ? params["length"] extends 0 ? def[k] extends Type | PreparsedResolution ? def[k] : k extends PrivateDeclaration<infer name extends keyof def & string> ? ErrorType<writeDuplicateAliasError<name>> : validateDefinition<def[k], bootstrapAliases<def>, {}> : validateDefinition<def[k], bootstrapAliases<def>, baseGenericConstraints<params>> : params : never;
[k in keyof def]: parseScopeKey<k, def>["params"] extends infer params ? params extends array<GenericParamAst> ? params["length"] extends 0 ? def[k] extends Type.Any | PreparsedResolution ? def[k] : k extends PrivateDeclaration<infer name extends keyof def & string> ? ErrorType<writeDuplicateAliasError<name>> : validateDefinition<def[k], bootstrapAliases<def>, {}> : validateDefinition<def[k], bootstrapAliases<def>, baseGenericConstraints<params>> : params : never;
};

@@ -24,9 +24,15 @@ export type inferScope<def> = inferBootstrapped<bootstrapAliases<def>>;

type bootstrapAliases<def> = {
[k in Exclude<keyof def, GenericDeclaration | symbol>]: def[k] extends PreparsedResolution ? def[k] : def[k] extends (() => infer thunkReturn extends PreparsedResolution) ? thunkReturn : Def<def[k]>;
[k in Exclude<keyof def, GenericDeclaration>]: def[k] extends (PreparsedResolution) ? def[k] extends {
t: infer g extends GenericAst;
} ? g : def[k] : def[k] extends (() => infer thunkReturn extends PreparsedResolution) ? thunkReturn extends {
t: infer g extends GenericAst;
} ? g : thunkReturn : Def<def[k]>;
} & {
[k in keyof def & GenericDeclaration as extractGenericName<k>]: GenericProps<parseValidGenericParams<extractGenericParameters<k>, bootstrapAliases<def>>, def[k], UnparsedScope>;
[k in keyof def & GenericDeclaration as extractGenericName<k>]: GenericAst<parseValidGenericParams<extractGenericParameters<k>, bootstrapAliases<def>>, def[k], UnparsedScope>;
};
type inferBootstrapped<$> = show<{
[name in keyof $]: $[name] extends Def<infer def> ? inferDefinition<def, $, {}> : $[name] extends (Generic<infer params, infer def> | GenericProps<infer params, infer def>) ? Generic<params, def, $> : $[name];
}>;
type inferBootstrapped<$> = {
[name in keyof $]: $[name] extends Def<infer def> ? inferDefinition<def, $, {}> : $[name] extends {
t: GenericAst<infer params, infer def, infer body$>;
} ? GenericAst<params, def, body$ extends UnparsedScope ? $ : body$, $> : $[name] extends Module<infer exports> ? Submodule<exports> : never;
} & unknown;
type extractGenericName<k> = k extends GenericDeclaration<infer name> ? name : never;

@@ -40,5 +46,7 @@ type extractGenericParameters<k> = k extends `${string}<${infer params}>` ? ParameterString<params> : never;

[arkKind]: "module";
} ? k & string : never;
} ? [
$[k]
] extends [anyOrNever] ? never : k & string : never;
}[keyof $];
export type tryInferSubmoduleReference<$, token> = token extends `${infer submodule extends moduleKeyOf<$>}.${infer subalias}` ? subalias extends keyof $[submodule] ? $[submodule][subalias] : never : token extends `${infer submodule}.${infer subalias}` ? submodule extends moduleKeyOf<ArkEnv.$> ? subalias extends keyof ArkEnv.$[submodule] ? ArkEnv.$[submodule][subalias] : never : never : never;
export type tryInferSubmoduleReference<$, token> = token extends `${infer submodule extends moduleKeyOf<$>}.${infer subalias}` ? subalias extends keyof $[submodule] ? $[submodule][subalias] : tryInferSubmoduleReference<$[submodule], subalias> : token extends (`${infer submodule extends moduleKeyOf<Ark>}.${infer subalias}`) ? subalias extends keyof Ark[submodule] ? Ark[submodule][subalias] : tryInferSubmoduleReference<Ark[submodule], subalias> : never;
export interface ParseContext extends TypeParseOptions {

@@ -51,7 +59,5 @@ $: InternalScope;

export declare const scope: ScopeParser;
export declare class InternalScope<$ extends InternalResolutions = InternalResolutions> extends InternalBaseScope<$> {
export declare class InternalScope<$ extends InternalResolutions = InternalResolutions> extends BaseScope<$> {
private parseCache;
constructor(def: Record<string, unknown>, config?: ArkConfig);
type: InternalTypeParser;
match: MatchParser<$>;
declare: () => {

@@ -67,17 +73,32 @@ type: InternalTypeParser;

}
export interface Scope<$ = any> extends BaseScope<$> {
export interface Scope<$ = {}> {
t: $;
[arkKind]: "scope";
config: ArkScopeConfig;
references: readonly BaseNode[];
json: Json;
exportedNames: array<exportedNameOf<$>>;
/** The set of names defined at the root-level of the scope mapped to their
* corresponding definitions.**/
aliases: Record<string, unknown>;
internal: toInternalScope<$>;
defineSchema<const def extends RootSchema>(schema: def): def;
schema(schema: RootSchema, opts?: NodeParseOptions): BaseRoot;
node<kinds extends NodeKind | array<RootKind>>(kinds: kinds, schema: NodeSchema<flattenListable<kinds>>, opts?: NodeParseOptions): Node<reducibleKindOf<flattenListable<kinds>>>;
type: TypeParser<$>;
match: MatchParser<$>;
declare: DeclarationParser<$>;
define: DefinitionParser<$>;
generic: GenericHktParser<$>;
import<names extends exportedNameOf<$>[]>(...names: names): Module<show<destructuredImportContext<$, names>>>;
export<names extends exportedNameOf<$>[]>(...names: names): Module<show<destructuredExportContext<$, names>>>;
import(): Module<{
[k in exportedNameOf<$> as PrivateDeclaration<k>]: $[k];
}>;
import<names extends exportedNameOf<$>[]>(...names: names): BoundModule<destructuredImportContext<$, names>, $>;
export(): Module<{
[k in exportedNameOf<$>]: $[k];
}>;
export<names extends exportedNameOf<$>[]>(...names: names): BoundModule<show<destructuredExportContext<$, names>>, $>;
resolve<name extends exportedNameOf<$>>(name: name): instantiateExport<$[name], $>;
}
export declare const Scope: new <$ = any>() => Scope<$>;
export declare const Scope: new <$ = {}>(...args: ConstructorParameters<typeof InternalScope>) => Scope<$>;
export declare const writeShallowCycleErrorMessage: (name: string, seen: string[]) => string;
export type ParsedScopeKey = {
name: string;
params: array<GenericParamDef>;
};
export type parseScopeKey<k, def> = k extends `${infer name}<${infer params}>` ? parseGenericScopeKey<name, params, def> : {

@@ -84,0 +105,0 @@ name: k;

@@ -35,6 +35,5 @@ var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {

};
import { InternalBaseScope, hasArkKind, parseGeneric } from "@ark/schema";
import { BaseScope, hasArkKind, parseGeneric } from "@ark/schema";
import { bound, domainOf, hasDomain, isThunk, throwParseError } from "@ark/util";
import { parseGenericParams } from "./generic.js";
import { createMatchParser } from "./match.js";
import { parseObject, writeBadDefinitionTypeMessage } from "./parser/definition.js";

@@ -48,3 +47,3 @@ import { DynamicState } from "./parser/string/reduce/dynamic.js";

let InternalScope = (() => {
let _classSuper = InternalBaseScope;
let _classSuper = BaseScope;
let _instanceExtraInitializers = [];

@@ -60,7 +59,3 @@ let _parseRoot_decorators;

parseCache = (__runInitializers(this, _instanceExtraInitializers), {});
constructor(def, config) {
super(def, config);
}
type = new InternalTypeParser(this);
match = createMatchParser(this);
declare = (() => ({

@@ -67,0 +62,0 @@ type: this.type

@@ -1,4 +0,4 @@

import { ArkErrors, BaseRoot, type BaseMeta, type Disjoint, type DivisorSchema, type ExactLengthSchema, type ExclusiveDateRangeSchema, type ExclusiveNumericRangeSchema, type InclusiveDateRangeSchema, type InclusiveNumericRangeSchema, type Morph, type MorphAst, type NodeSchema, type Out, type PatternSchema, type Predicate, type PrimitiveConstraintKind, type Root, type arkKeyOf, type constrain, type constraintKindOf, type distillIn, type distillOut, type exclusivizeRangeSchema, type getArkKey, type inferIntersection, type inferMorphOut, type inferPipes, type inferPredicate, type toArkKey, type validateChainedAsArgs, type validateChainedConstraint, type validateStructuralOperand } from "@ark/schema";
import { Callable, type Constructor, type array, type conform, type unset } from "@ark/util";
import type { type } from "./ark.js";
import { ArkErrors, BaseRoot, type BaseMeta, type Morph, type Predicate } from "@ark/schema";
import { Callable, type Constructor, type array, type conform } from "@ark/util";
import type { distillIn, distillOut } from "./ast.js";
import { type Generic, type ParameterString, type baseGenericConstraints, type parseValidGenericParams, type validateParameterString } from "./generic.js";

@@ -8,9 +8,11 @@ import type { inferDefinition, validateDeclared, validateDefinition } from "./parser/definition.js";

import type { InternalScope, Scope, bindThis } from "./scope.js";
import type { BaseType } from "./subtypes/base.js";
import type { instantiateType } from "./subtypes/instantiate.js";
/** The convenience properties attached to `type` */
export type TypeParserAttachments = Omit<TypeParser, never>;
export interface TypeParser<$ = {}> {
<const def>(def: validateTypeRoot<def, $>): Type<inferTypeRoot<def, $>, $>;
<const zero, const one, const rest extends array>(_0: zero extends IndexZeroOperator ? zero : validateTypeRoot<zero, $>, _1: zero extends "keyof" ? validateTypeRoot<one, $> : zero extends "instanceof" ? conform<one, Constructor> : zero extends "===" ? conform<one, unknown> : conform<one, IndexOneOperator>, ..._2: zero extends "===" ? rest : zero extends "instanceof" ? conform<rest, readonly Constructor[]> : one extends TupleInfixOperator ? one extends ":" ? [Predicate<distillIn<inferTypeRoot<zero, $>>>] : one extends "=>" ? [Morph<distillOut<inferTypeRoot<zero, $>>, unknown>] : one extends "@" ? [string | BaseMeta] : [validateTypeRoot<rest[0], $>] : []): Type<inferTypeRoot<[zero, one, ...rest], $>, $>;
<const def, r = Type<inferTypeRoot<def, $>, $>>(def: validateTypeRoot<def, $>): r;
<params extends ParameterString, const def>(params: validateParameterString<params, $>, def: validateDefinition<def, $, baseGenericConstraints<parseValidGenericParams<params, $>>>): Generic<parseValidGenericParams<params, $>, def, $>;
raw(def: unknown): Type<any, $>;
<const zero, const one, const rest extends array, r = Type<inferTypeRoot<[zero, one, ...rest], $>, $>>(_0: zero extends IndexZeroOperator ? zero : validateTypeRoot<zero, $>, _1: zero extends "keyof" ? validateTypeRoot<one, $> : zero extends "instanceof" ? conform<one, Constructor> : zero extends "===" ? conform<one, unknown> : conform<one, IndexOneOperator>, ..._2: zero extends "===" ? rest : zero extends "instanceof" ? conform<rest, readonly Constructor[]> : one extends TupleInfixOperator ? one extends ":" ? [Predicate<distillIn<inferTypeRoot<zero, $>>>] : one extends "=>" ? [Morph<distillOut<inferTypeRoot<zero, $>>, unknown>] : one extends "@" ? [string | BaseMeta] : [validateTypeRoot<rest[0], $>] : []): r;
raw(def: unknown): BaseType<any, $>;
errors: typeof ArkErrors;

@@ -22,70 +24,14 @@ }

export type DeclarationParser<$> = <preinferred>() => {
type: <def>(def: validateDeclared<preinferred, def, $, bindThis<def>>) => Type<preinferred, $>;
type: <const def>(def: validateDeclared<preinferred, def, $, bindThis<def>>) => Type<preinferred, $>;
};
declare class _Type<t = unknown, $ = any> extends Root<t, $> {
$: Scope<$>;
as<t = unset>(...args: validateChainedAsArgs<t>): Type<t, $>;
get in(): Type<this["tIn"], $>;
get out(): Type<this["tOut"], $>;
intersect<def>(def: validateTypeRoot<def, $>): Type<inferIntersection<t, inferTypeRoot<def, $>>> | Disjoint;
and<def>(def: validateTypeRoot<def, $>): Type<inferIntersection<t, inferTypeRoot<def, $>>, $>;
or<def>(def: validateTypeRoot<def, $>): Type<t | inferTypeRoot<def, $>, $>;
array(): Type<t[], $>;
keyof(): Type<keyof this["inferIn"], $>;
pipe<a extends Morph<this["infer"]>>(a: a): Type<inferPipes<t, [a]>, $>;
pipe<a extends Morph<this["infer"]>, b extends Morph<inferMorphOut<a>>>(a: a, b: b): Type<inferPipes<t, [a, b]>, $>;
pipe<a extends Morph<this["infer"]>, b extends Morph<inferMorphOut<a>>, c extends Morph<inferMorphOut<b>>>(a: a, b: b, c: c): Type<inferPipes<t, [a, b, c]>, $>;
pipe<a extends Morph<this["infer"]>, b extends Morph<inferMorphOut<a>>, c extends Morph<inferMorphOut<b>>, d extends Morph<inferMorphOut<c>>>(a: a, b: b, c: c, d: d): Type<inferPipes<t, [a, b, c, d]>, $>;
pipe<a extends Morph<this["infer"]>, b extends Morph<inferMorphOut<a>>, c extends Morph<inferMorphOut<b>>, d extends Morph<inferMorphOut<c>>, e extends Morph<inferMorphOut<d>>>(a: a, b: b, c: c, d: d, e: e): Type<inferPipes<t, [a, b, c, d, e]>, $>;
pipe<a extends Morph<this["infer"]>, b extends Morph<inferMorphOut<a>>, c extends Morph<inferMorphOut<b>>, d extends Morph<inferMorphOut<c>>, e extends Morph<inferMorphOut<d>>, f extends Morph<inferMorphOut<e>>>(a: a, b: b, c: c, d: d, e: e, f: f): Type<inferPipes<t, [a, b, c, d, e, f]>, $>;
pipe<a extends Morph<this["infer"]>, b extends Morph<inferMorphOut<a>>, c extends Morph<inferMorphOut<b>>, d extends Morph<inferMorphOut<c>>, e extends Morph<inferMorphOut<d>>, f extends Morph<inferMorphOut<e>>, g extends Morph<inferMorphOut<f>>>(a: a, b: b, c: c, d: d, e: e, f: f, g: g): Type<inferPipes<t, [a, b, c, d, e, f, g]>, $>;
narrow<predicate extends Predicate<distillOut<t>>>(predicate: predicate): Type<t extends MorphAst ? inferPredicate<this["tOut"], predicate> extends infer narrowed ? (In: this["tIn"]) => Out<narrowed> : never : inferPredicate<t, predicate>, $>;
equals<def>(def: validateTypeRoot<def, $>): this is Type<inferTypeRoot<def>, $>;
extract<def>(r: validateTypeRoot<def, $>): Type<Extract<t, inferTypeRoot<def, $>>, $>;
exclude<def>(r: validateTypeRoot<def, $>): Type<Exclude<t, inferTypeRoot<def, $>>, $>;
extends<def>(other: validateTypeRoot<def, $>): this is Type<inferTypeRoot<def>, $>;
overlaps<def>(r: validateTypeRoot<def, $>): boolean;
omit<const key extends arkKeyOf<t> = never>(this: validateStructuralOperand<"omit", this>, ...keys: array<key | type.cast<key>>): Type<{
[k in keyof t as Exclude<toArkKey<t, k>, key>]: t[k];
}, $>;
pick<const key extends arkKeyOf<t> = never>(this: validateStructuralOperand<"pick", this>, ...keys: array<key | type.cast<key>>): Type<{
[k in keyof t as Extract<toArkKey<t, k>, key>]: t[k];
}, $>;
required(this: validateStructuralOperand<"required", this>): Type<{
[k in keyof this["inferIn"]]-?: this["inferIn"][k];
}, $>;
partial(this: validateStructuralOperand<"partial", this>): Type<{
[k in keyof this["inferIn"]]?: this["inferIn"][k];
}, $>;
get<k1 extends arkKeyOf<t>>(k1: k1 | type.cast<k1>): Type<getArkKey<t, k1>, $>;
get<k1 extends arkKeyOf<t>, k2 extends arkKeyOf<getArkKey<t, k1>>>(k1: k1 | type.cast<k1>, k2: k2 | type.cast<k2>): Type<getArkKey<getArkKey<t, k1>, k2>, $>;
get<k1 extends arkKeyOf<t>, k2 extends arkKeyOf<getArkKey<t, k1>>, k3 extends arkKeyOf<getArkKey<getArkKey<t, k1>, k2>>>(k1: k1 | type.cast<k1>, k2: k2 | type.cast<k2>, k3: k3 | type.cast<k3>): Type<getArkKey<getArkKey<getArkKey<t, k1>, k2>, k3>, $>;
constrain<kind extends PrimitiveConstraintKind, const def extends NodeSchema<kind>>(kind: conform<kind, constraintKindOf<this["inferIn"]>>, def: def): Type<constrain<t, kind, def>, $>;
satisfying<predicate extends Predicate<distillIn<t>>>(predicate: predicate): Type<t extends MorphAst ? (In: inferPredicate<this["tIn"], predicate>) => Out<this["tOut"]> : inferPredicate<t, predicate>, $>;
divisibleBy<const schema extends DivisorSchema>(this: validateChainedConstraint<"divisor", this>, schema: schema): Type<constrain<t, "divisor", schema>, $>;
matching<const schema extends PatternSchema>(this: validateChainedConstraint<"pattern", this>, schema: schema): Type<constrain<t, "pattern", schema>, $>;
atLeast<const schema extends InclusiveNumericRangeSchema>(this: validateChainedConstraint<"min", this>, schema: schema): Type<constrain<t, "min", schema>, $>;
atMost<const schema extends InclusiveNumericRangeSchema>(this: validateChainedConstraint<"max", this>, schema: schema): Type<constrain<t, "max", schema>, $>;
moreThan<const schema extends ExclusiveNumericRangeSchema>(this: validateChainedConstraint<"min", this>, schema: schema): Type<constrain<t, "min", exclusivizeRangeSchema<schema>>, $>;
lessThan<const schema extends ExclusiveNumericRangeSchema>(this: validateChainedConstraint<"max", this>, schema: schema): Type<constrain<t, "max", exclusivizeRangeSchema<schema>>, $>;
atLeastLength<const schema extends InclusiveNumericRangeSchema>(this: validateChainedConstraint<"minLength", this>, schema: schema): Type<constrain<t, "minLength", schema>, $>;
atMostLength<const schema extends InclusiveNumericRangeSchema>(this: validateChainedConstraint<"maxLength", this>, schema: schema): Type<constrain<t, "maxLength", schema>, $>;
moreThanLength<const schema extends ExclusiveNumericRangeSchema>(this: validateChainedConstraint<"minLength", this>, schema: schema): Type<constrain<t, "minLength", exclusivizeRangeSchema<schema>>, $>;
lessThanLength<const schema extends ExclusiveNumericRangeSchema>(this: validateChainedConstraint<"maxLength", this>, schema: schema): Type<constrain<t, "maxLength", exclusivizeRangeSchema<schema>>, $>;
exactlyLength<const schema extends ExactLengthSchema>(this: validateChainedConstraint<"exactLength", this>, schema: schema): Type<constrain<t, "exactLength", schema>, $>;
atOrAfter<const schema extends InclusiveDateRangeSchema>(this: validateChainedConstraint<"after", this>, schema: schema): Type<constrain<t, "after", schema>, $>;
atOrBefore<const schema extends InclusiveDateRangeSchema>(this: validateChainedConstraint<"before", this>, schema: schema): Type<constrain<t, "before", schema>, $>;
laterThan<const schema extends ExclusiveDateRangeSchema>(this: validateChainedConstraint<"after", this>, schema: schema): Type<constrain<t, "after", exclusivizeRangeSchema<schema>>, $>;
earlierThan<const schema extends ExclusiveDateRangeSchema>(this: validateChainedConstraint<"before", this>, schema: schema): Type<constrain<t, "before", exclusivizeRangeSchema<schema>>, $>;
export type DefinitionParser<$> = <def>(def: validateTypeRoot<def, $>) => def;
export type validateTypeRoot<def, $ = {}> = validateDefinition<def, $, bindThis<def>>;
export type inferTypeRoot<def, $> = inferDefinition<def, $, bindThis<def>>;
export type validateAmbient<def> = validateTypeRoot<def, {}>;
export type inferAmbient<def> = inferTypeRoot<def, {}>;
export type Type<t = unknown, $ = {}> = instantiateType<t, $>;
export declare namespace Type {
type Any<t = any> = BaseType<t, any>;
}
export interface Type<
/** @ts-expect-error allow instantiation assignment to the base type */
out t = unknown, $ = {}> extends _Type<t, $> {
}
export type TypeConstructor<t = unknown, $ = {}> = new (def: unknown, $: Scope<$>) => Type<t, $>;
export type AnyType<out t = unknown> = Type<t, any>;
export declare const Type: TypeConstructor;
export type DefinitionParser<$> = <def>(def: validateTypeRoot<def, $>) => def;
export type validateTypeRoot<def, $ = {}> = validateDefinition<def, $, bindThis<def>>;
export type inferTypeRoot<def, $ = {}> = inferDefinition<def, $, bindThis<def>>;
export {};
{
"name": "arktype",
"description": "TypeScript's 1:1 validator, optimized from editor to runtime",
"version": "2.0.0-beta.2",
"version": "2.0.0-beta.3",
"license": "MIT",

@@ -28,4 +28,4 @@ "author": {

"dependencies": {
"@ark/util": "0.1.2",
"@ark/schema": "0.2.2"
"@ark/util": "0.2.0",
"@ark/schema": "0.3.0"
},

@@ -32,0 +32,0 @@ "publishConfig": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc