arktype 2.0.0-dev.11 → 2.0.0-dev.12
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.
- package/out/api.d.ts +1 -1
- package/out/api.js +1 -1
- package/out/module.d.ts +4 -5
- package/out/module.js +2 -3
- package/out/parser/definition.d.ts +1 -1
- package/out/parser/string/shift/operand/unenclosed.d.ts +2 -2
- package/out/scope.d.ts +3 -3
- package/out/scope.js +2 -2
- package/out/type.d.ts +1 -1
- package/out/type.js +1 -1
- package/package.json +3 -3
package/out/api.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { ArkError, ArkErrors
|
|
1
|
+
export { ArkError as ArkError, ArkErrors } from "@arktype/schema";
|
|
2
2
|
export type { Ark, ArkConfig, Out } from "@arktype/schema";
|
|
3
3
|
export { ambient, ark, declare, define, match, type } from "./ark.js";
|
|
4
4
|
export { Module } from "./module.js";
|
package/out/api.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { ArkError, ArkErrors
|
|
1
|
+
export { ArkError as ArkError, ArkErrors } from "@arktype/schema";
|
|
2
2
|
export { ambient, ark, declare, define, match, type } from "./ark.js";
|
|
3
3
|
export { Module } from "./module.js";
|
|
4
4
|
export { scope } from "./scope.js";
|
package/out/module.d.ts
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import { RootModule, type PreparsedNodeResolution } from "@arktype/schema";
|
|
2
|
+
import type { anyOrNever } from "@arktype/util";
|
|
3
3
|
import type { Type } from "./type.js";
|
|
4
4
|
type exportScope<$> = {
|
|
5
5
|
[k in keyof $]: $[k] extends PreparsedNodeResolution ? [
|
|
6
6
|
$[k]
|
|
7
7
|
] extends [anyOrNever] ? Type<$[k], $> : $[k] : Type<$[k], $>;
|
|
8
8
|
};
|
|
9
|
-
export declare
|
|
10
|
-
|
|
11
|
-
}
|
|
9
|
+
export declare const Module: new <$ = {}>(types: exportScope<$>) => Module<$>;
|
|
10
|
+
export type Module<$ = {}> = RootModule<exportScope<$>>;
|
|
12
11
|
export {};
|
package/out/module.js
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export
|
|
3
|
-
}
|
|
1
|
+
import { RootModule } from "@arktype/schema";
|
|
2
|
+
export const Module = RootModule;
|
|
@@ -10,7 +10,7 @@ export declare const parseObject: (def: object, ctx: ParseContext) => BaseRoot;
|
|
|
10
10
|
export type inferDefinition<def, $, args> = [
|
|
11
11
|
def
|
|
12
12
|
] 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;
|
|
13
|
-
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 ? writeBadDefinitionTypeMessage<objectKindOrDomainOf<def
|
|
13
|
+
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>;
|
|
14
14
|
export type validateDeclared<declared, def, $, args> = def extends validateDefinition<def, $, args> ? validateInference<def, declared, $, args> : validateDefinition<def, $, args>;
|
|
15
15
|
type validateInference<def, declared, $, args> = def extends RegExp | type.cast<unknown> | ThunkCast | TupleExpression ? validateShallowInference<def, declared, $, args> : def extends array ? declared extends array ? {
|
|
16
16
|
[i in keyof declared]: i extends keyof def ? validateInference<def[i], declared[i], $, args> : declared[i];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BaseRoot, type GenericProps, type arkKind, type writeNonSubmoduleDotMessage
|
|
1
|
+
import { BaseRoot, writeUnresolvableMessage, type GenericProps, type arkKind, type writeNonSubmoduleDotMessage } from "@arktype/schema";
|
|
2
2
|
import { type BigintLiteral, type Completion, type ErrorMessage, type anyOrNever, type join } from "@arktype/util";
|
|
3
3
|
import type { Generic } from "../../../../generic.js";
|
|
4
4
|
import type { GenericInstantiationAst } from "../../../semantic/infer.js";
|
|
@@ -6,7 +6,7 @@ import type { DynamicState } from "../../reduce/dynamic.js";
|
|
|
6
6
|
import type { StaticState, state } from "../../reduce/static.js";
|
|
7
7
|
import type { BaseCompletions } from "../../string.js";
|
|
8
8
|
import type { Scanner } from "../scanner.js";
|
|
9
|
-
import {
|
|
9
|
+
import { parseGenericArgs, writeInvalidGenericArgsMessage, type ParsedArgs } from "./genericArgs.js";
|
|
10
10
|
export declare const parseUnenclosed: (s: DynamicState) => void;
|
|
11
11
|
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 keyof $ ? [
|
|
12
12
|
$[result]
|
package/out/scope.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { type MatchParser } from "./match.js";
|
|
|
6
6
|
import type { Module } from "./module.js";
|
|
7
7
|
import { type inferDefinition, type validateDefinition } from "./parser/definition.js";
|
|
8
8
|
import { parseGenericParams, type GenericDeclaration, type GenericParamsParseError } from "./parser/generic.js";
|
|
9
|
-
import {
|
|
9
|
+
import { _TypeParser, type DeclarationParser, type DefinitionParser, type Type, type TypeParser } from "./type.js";
|
|
10
10
|
export type ScopeParser = <const def>(def: validateScope<def>, config?: ArkConfig) => Scope<inferBootstrapped<bootstrapAliases<def>>>;
|
|
11
11
|
type validateScope<def> = {
|
|
12
12
|
[k in keyof def]: k extends symbol ? unknown : parseScopeKey<k>["params"] extends [] ? def[k] extends Type | PreparsedResolution ? def[k] : k extends PrivateDeclaration<infer name extends keyof def & string> ? keyError<writeDuplicateAliasError<name>> : validateDefinition<def[k], ambient & bootstrapAliases<def>, {}> : parseScopeKey<k>["params"] extends GenericParamsParseError ? parseScopeKey<k>["params"][0] : validateDefinition<def[k], ambient & bootstrapAliases<def>, {
|
|
@@ -57,10 +57,10 @@ export interface Scope<$ = any> extends RootScope<$> {
|
|
|
57
57
|
export declare class RawScope<$ extends RawRootResolutions = RawRootResolutions> extends RawRootScope<$> {
|
|
58
58
|
private parseCache;
|
|
59
59
|
constructor(def: Record<string, unknown>, config?: ArkConfig);
|
|
60
|
-
type:
|
|
60
|
+
type: _TypeParser;
|
|
61
61
|
match: MatchParser<$>;
|
|
62
62
|
declare: () => {
|
|
63
|
-
type:
|
|
63
|
+
type: _TypeParser;
|
|
64
64
|
};
|
|
65
65
|
define: (def: unknown) => unknown;
|
|
66
66
|
preparseRoot(def: unknown): unknown;
|
package/out/scope.js
CHANGED
|
@@ -6,7 +6,7 @@ import { parseObject, writeBadDefinitionTypeMessage } from "./parser/definition.
|
|
|
6
6
|
import { parseGenericParams } from "./parser/generic.js";
|
|
7
7
|
import { DynamicState } from "./parser/string/reduce/dynamic.js";
|
|
8
8
|
import { fullStringParse } from "./parser/string/string.js";
|
|
9
|
-
import {
|
|
9
|
+
import { _TypeParser } from "./type.js";
|
|
10
10
|
export const scope = ((def, config = {}) => new RawScope(def, config));
|
|
11
11
|
export class RawScope extends RawRootScope {
|
|
12
12
|
parseCache = {};
|
|
@@ -22,7 +22,7 @@ export class RawScope extends RawRootScope {
|
|
|
22
22
|
}
|
|
23
23
|
super(aliases, config);
|
|
24
24
|
}
|
|
25
|
-
type = new
|
|
25
|
+
type = new _TypeParser(this);
|
|
26
26
|
match = createMatchParser(this);
|
|
27
27
|
declare = (() => ({
|
|
28
28
|
type: this.type
|
package/out/type.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ export interface TypeParser<$> extends TypeParserAttachments {
|
|
|
15
15
|
[param in parseGenericParams<params>[number]]: unknown;
|
|
16
16
|
}>): Generic<parseGenericParams<params>, def, $>;
|
|
17
17
|
}
|
|
18
|
-
export declare class
|
|
18
|
+
export declare class _TypeParser extends Callable<(...args: unknown[]) => BaseRoot | Generic, TypeParserAttachments> {
|
|
19
19
|
constructor($: RawScope);
|
|
20
20
|
}
|
|
21
21
|
export type DeclarationParser<$> = <preinferred>() => {
|
package/out/type.js
CHANGED
|
@@ -5,7 +5,7 @@ import { parseGenericParams } from "./parser/generic.js";
|
|
|
5
5
|
const typeParserAttachments = Object.freeze({
|
|
6
6
|
errors: ArkErrors
|
|
7
7
|
});
|
|
8
|
-
export class
|
|
8
|
+
export class _TypeParser extends Callable {
|
|
9
9
|
constructor($) {
|
|
10
10
|
super((...args) => {
|
|
11
11
|
if (args.length === 1) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "arktype",
|
|
3
3
|
"description": "TypeScript's 1:1 validator, optimized from editor to runtime",
|
|
4
|
-
"version": "2.0.0-dev.
|
|
4
|
+
"version": "2.0.0-dev.12",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "David Blass",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"test": "tsx ../repo/testPackage.ts"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@arktype/util": "0.0.
|
|
40
|
-
"@arktype/schema": "0.1.
|
|
39
|
+
"@arktype/util": "0.0.41",
|
|
40
|
+
"@arktype/schema": "0.1.4"
|
|
41
41
|
}
|
|
42
42
|
}
|