arktype 2.0.0-dev.1 → 2.0.0-dev.11
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 +6 -0
- package/out/api.js +5 -0
- package/out/ark.d.ts +15 -39
- package/out/ark.js +9 -18
- package/out/config.d.ts +1 -0
- package/out/config.js +2 -0
- package/out/generic.d.ts +21 -0
- package/out/generic.js +24 -0
- package/out/main.d.ts +6 -7
- package/out/main.js +4 -3
- package/out/match.d.ts +57 -34
- package/out/match.js +51 -17
- package/out/module.d.ts +12 -0
- package/out/module.js +3 -0
- package/out/parser/definition.d.ts +14 -14
- package/out/parser/definition.js +10 -13
- package/out/parser/generic.d.ts +5 -7
- package/out/parser/generic.js +7 -11
- package/out/parser/objectLiteral.d.ts +44 -18
- package/out/parser/objectLiteral.js +57 -51
- package/out/parser/semantic/bounds.d.ts +10 -8
- package/out/parser/semantic/bounds.js +0 -1
- package/out/parser/semantic/divisor.d.ts +5 -7
- package/out/parser/semantic/divisor.js +0 -1
- package/out/parser/semantic/infer.d.ts +24 -0
- package/out/parser/semantic/infer.js +1 -0
- package/out/parser/semantic/utils.d.ts +3 -7
- package/out/parser/semantic/utils.js +0 -1
- package/out/parser/semantic/validate.d.ts +16 -13
- package/out/parser/semantic/validate.js +1 -1
- package/out/parser/string/reduce/dynamic.d.ts +13 -13
- package/out/parser/string/reduce/dynamic.js +31 -26
- package/out/parser/string/reduce/shared.d.ts +14 -28
- package/out/parser/string/reduce/shared.js +4 -3
- package/out/parser/string/reduce/static.d.ts +27 -24
- package/out/parser/string/reduce/static.js +0 -1
- package/out/parser/string/shift/operand/date.d.ts +2 -2
- package/out/parser/string/shift/operand/date.js +4 -7
- package/out/parser/string/shift/operand/enclosed.d.ts +3 -4
- package/out/parser/string/shift/operand/enclosed.js +14 -14
- package/out/parser/string/shift/operand/genericArgs.d.ts +9 -10
- package/out/parser/string/shift/operand/genericArgs.js +6 -10
- package/out/parser/string/shift/operand/operand.d.ts +3 -4
- package/out/parser/string/shift/operand/operand.js +8 -12
- package/out/parser/string/shift/operand/unenclosed.d.ts +16 -21
- package/out/parser/string/shift/operand/unenclosed.js +24 -36
- package/out/parser/string/shift/operator/bounds.d.ts +8 -12
- package/out/parser/string/shift/operator/bounds.js +45 -56
- package/out/parser/string/shift/operator/divisor.d.ts +1 -3
- package/out/parser/string/shift/operator/divisor.js +1 -3
- package/out/parser/string/shift/operator/operator.d.ts +1 -2
- package/out/parser/string/shift/operator/operator.js +12 -19
- package/out/parser/string/shift/scanner.d.ts +2 -2
- package/out/parser/string/shift/scanner.js +14 -16
- package/out/parser/string/string.d.ts +8 -6
- package/out/parser/string/string.js +1 -3
- package/out/parser/tuple.d.ts +102 -43
- package/out/parser/tuple.js +119 -87
- package/out/scope.d.ts +44 -119
- package/out/scope.js +39 -209
- package/out/type.d.ts +43 -64
- package/out/type.js +30 -131
- package/package.json +12 -10
- package/__tests__/array.test.ts +0 -272
- package/__tests__/astUtils.test.ts +0 -17
- package/__tests__/badDefinitionType.test.ts +0 -51
- package/__tests__/basis.test.ts +0 -46
- package/__tests__/bounds.test.ts +0 -388
- package/__tests__/cast.test.ts +0 -32
- package/__tests__/completions.test.ts +0 -46
- package/__tests__/config.test.ts +0 -168
- package/__tests__/cyclic.test.ts +0 -144
- package/__tests__/dateLiteral.test.ts +0 -32
- package/__tests__/declared.test.ts +0 -123
- package/__tests__/discrimination.test.ts +0 -74
- package/__tests__/divisor.test.ts +0 -90
- package/__tests__/enclosed.test.ts +0 -93
- package/__tests__/examples.test.ts +0 -56
- package/__tests__/expressions.test.ts +0 -138
- package/__tests__/generateBenchData.ts +0 -89
- package/__tests__/generated/cyclic.ts +0 -3058
- package/__tests__/generic.test.ts +0 -294
- package/__tests__/group.test.ts +0 -72
- package/__tests__/hkt.test.ts +0 -22
- package/__tests__/imports.test.ts +0 -113
- package/__tests__/instanceof.test.ts +0 -102
- package/__tests__/intersection.test.ts +0 -104
- package/__tests__/jsdoc.test.ts +0 -64
- package/__tests__/keyTraversal.test.ts +0 -73
- package/__tests__/keyof.test.ts +0 -134
- package/__tests__/keywords.test.ts +0 -188
- package/__tests__/literal.test.ts +0 -51
- package/__tests__/match.test.ts +0 -34
- package/__tests__/methods.bench.ts +0 -22
- package/__tests__/morph.test.ts +0 -409
- package/__tests__/narrow.test.ts +0 -102
- package/__tests__/nodeDefinitions.test.ts +0 -190
- package/__tests__/object.bench.ts +0 -28
- package/__tests__/objectLiteral.test.ts +0 -300
- package/__tests__/operand.bench.ts +0 -45
- package/__tests__/operator.bench.ts +0 -130
- package/__tests__/regex.test.ts +0 -58
- package/__tests__/scope.bench.ts +0 -39
- package/__tests__/scope.test.ts +0 -140
- package/__tests__/string.test.ts +0 -48
- package/__tests__/submodule.test.ts +0 -99
- package/__tests__/this.test.ts +0 -57
- package/__tests__/thunk.test.ts +0 -80
- package/__tests__/traverse.test.ts +0 -119
- package/__tests__/tsGenerics.test.ts +0 -12
- package/__tests__/typeMethods.test.ts +0 -69
- package/__tests__/typeReference.test.ts +0 -39
- package/__tests__/unenclosed.test.ts +0 -120
- package/__tests__/union.test.ts +0 -147
- package/ark.ts +0 -91
- package/main.ts +0 -18
- package/match.ts +0 -116
- package/out/ark.d.ts.map +0 -1
- package/out/ark.js.map +0 -1
- package/out/arkConfig.d.ts +0 -2
- package/out/arkConfig.d.ts.map +0 -1
- package/out/arkConfig.js +0 -10
- package/out/arkConfig.js.map +0 -1
- package/out/main.d.ts.map +0 -1
- package/out/main.js.map +0 -1
- package/out/match.d.ts.map +0 -1
- package/out/match.js.map +0 -1
- package/out/parser/definition.d.ts.map +0 -1
- package/out/parser/definition.js.map +0 -1
- package/out/parser/generic.d.ts.map +0 -1
- package/out/parser/generic.js.map +0 -1
- package/out/parser/objectLiteral.d.ts.map +0 -1
- package/out/parser/objectLiteral.js.map +0 -1
- package/out/parser/semantic/bounds.d.ts.map +0 -1
- package/out/parser/semantic/bounds.js.map +0 -1
- package/out/parser/semantic/divisor.d.ts.map +0 -1
- package/out/parser/semantic/divisor.js.map +0 -1
- package/out/parser/semantic/intersections.d.ts +0 -14
- package/out/parser/semantic/intersections.d.ts.map +0 -1
- package/out/parser/semantic/intersections.js +0 -2
- package/out/parser/semantic/intersections.js.map +0 -1
- package/out/parser/semantic/semantic.d.ts +0 -33
- package/out/parser/semantic/semantic.d.ts.map +0 -1
- package/out/parser/semantic/semantic.js +0 -2
- package/out/parser/semantic/semantic.js.map +0 -1
- package/out/parser/semantic/utils.d.ts.map +0 -1
- package/out/parser/semantic/utils.js.map +0 -1
- package/out/parser/semantic/validate.d.ts.map +0 -1
- package/out/parser/semantic/validate.js.map +0 -1
- package/out/parser/shared.d.ts +0 -54
- package/out/parser/shared.d.ts.map +0 -1
- package/out/parser/shared.js +0 -47
- package/out/parser/shared.js.map +0 -1
- package/out/parser/string/reduce/dynamic.d.ts.map +0 -1
- package/out/parser/string/reduce/dynamic.js.map +0 -1
- package/out/parser/string/reduce/shared.d.ts.map +0 -1
- package/out/parser/string/reduce/shared.js.map +0 -1
- package/out/parser/string/reduce/static.d.ts.map +0 -1
- package/out/parser/string/reduce/static.js.map +0 -1
- package/out/parser/string/shift/operand/date.d.ts.map +0 -1
- package/out/parser/string/shift/operand/date.js.map +0 -1
- package/out/parser/string/shift/operand/enclosed.d.ts.map +0 -1
- package/out/parser/string/shift/operand/enclosed.js.map +0 -1
- package/out/parser/string/shift/operand/genericArgs.d.ts.map +0 -1
- package/out/parser/string/shift/operand/genericArgs.js.map +0 -1
- package/out/parser/string/shift/operand/operand.d.ts.map +0 -1
- package/out/parser/string/shift/operand/operand.js.map +0 -1
- package/out/parser/string/shift/operand/unenclosed.d.ts.map +0 -1
- package/out/parser/string/shift/operand/unenclosed.js.map +0 -1
- package/out/parser/string/shift/operator/bounds.d.ts.map +0 -1
- package/out/parser/string/shift/operator/bounds.js.map +0 -1
- package/out/parser/string/shift/operator/divisor.d.ts.map +0 -1
- package/out/parser/string/shift/operator/divisor.js.map +0 -1
- package/out/parser/string/shift/operator/operator.d.ts.map +0 -1
- package/out/parser/string/shift/operator/operator.js.map +0 -1
- package/out/parser/string/shift/scanner.d.ts.map +0 -1
- package/out/parser/string/shift/scanner.js.map +0 -1
- package/out/parser/string/string.d.ts.map +0 -1
- package/out/parser/string/string.js.map +0 -1
- package/out/parser/tuple.d.ts.map +0 -1
- package/out/parser/tuple.js.map +0 -1
- package/out/scope.d.ts.map +0 -1
- package/out/scope.js.map +0 -1
- package/out/test.d.ts +0 -2
- package/out/test.d.ts.map +0 -1
- package/out/test.js +0 -7
- package/out/test.js.map +0 -1
- package/out/tsconfig.build.tsbuildinfo +0 -1
- package/out/type.d.ts.map +0 -1
- package/out/type.js.map +0 -1
- package/out/util.d.ts +0 -19
- package/out/util.d.ts.map +0 -1
- package/out/util.js +0 -7
- package/out/util.js.map +0 -1
- package/parser/definition.ts +0 -159
- package/parser/generic.ts +0 -68
- package/parser/objectLiteral.ts +0 -197
- package/parser/semantic/bounds.ts +0 -61
- package/parser/semantic/divisor.ts +0 -13
- package/parser/semantic/intersections.ts +0 -46
- package/parser/semantic/semantic.ts +0 -144
- package/parser/semantic/utils.ts +0 -26
- package/parser/semantic/validate.ts +0 -109
- package/parser/shared.ts +0 -152
- package/parser/string/reduce/dynamic.ts +0 -196
- package/parser/string/reduce/shared.ts +0 -101
- package/parser/string/reduce/static.ts +0 -298
- package/parser/string/shift/operand/date.ts +0 -54
- package/parser/string/shift/operand/enclosed.ts +0 -118
- package/parser/string/shift/operand/genericArgs.ts +0 -127
- package/parser/string/shift/operand/operand.ts +0 -48
- package/parser/string/shift/operand/unenclosed.ts +0 -268
- package/parser/string/shift/operator/bounds.ts +0 -264
- package/parser/string/shift/operator/divisor.ts +0 -36
- package/parser/string/shift/operator/operator.ts +0 -82
- package/parser/string/shift/scanner.ts +0 -209
- package/parser/string/string.ts +0 -90
- package/parser/tuple.ts +0 -474
- package/scope.ts +0 -574
- package/type.ts +0 -347
- package/util.ts +0 -36
|
@@ -1,18 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { isKeyOf, throwParseError
|
|
3
|
-
import { maxComparators, writeUnpairableComparatorMessage } from "../../reduce/shared.js";
|
|
1
|
+
import { internalKeywords, jsObjects, tsKeywords, writeUnboundableMessage } from "@arktype/schema";
|
|
2
|
+
import { isKeyOf, throwParseError } from "@arktype/util";
|
|
3
|
+
import { invertedComparators, maxComparators, writeUnpairableComparatorMessage } from "../../reduce/shared.js";
|
|
4
4
|
import { extractDateLiteralSource, isDateLiteral } from "../operand/date.js";
|
|
5
5
|
export const parseBound = (s, start) => {
|
|
6
6
|
const comparator = shiftComparator(s, start);
|
|
7
|
-
if (s.root.
|
|
7
|
+
if (s.root.hasKind("unit")) {
|
|
8
8
|
if (typeof s.root.unit === "number") {
|
|
9
|
+
s.reduceLeftBound(s.root.unit, comparator);
|
|
9
10
|
s.unsetRoot();
|
|
10
|
-
return
|
|
11
|
+
return;
|
|
11
12
|
}
|
|
12
13
|
if (s.root.unit instanceof Date) {
|
|
13
|
-
s.unsetRoot();
|
|
14
14
|
const literal = `d'${s.root.description ?? s.root.unit.toISOString()}'`;
|
|
15
|
-
|
|
15
|
+
s.unsetRoot();
|
|
16
|
+
s.reduceLeftBound(literal, comparator);
|
|
17
|
+
return;
|
|
16
18
|
}
|
|
17
19
|
}
|
|
18
20
|
return parseRightBound(s, comparator);
|
|
@@ -26,49 +28,39 @@ export const comparatorStartChars = {
|
|
|
26
28
|
">": 1,
|
|
27
29
|
"=": 1
|
|
28
30
|
};
|
|
29
|
-
const shiftComparator = (s, start) => s.scanner.lookaheadIs("=")
|
|
30
|
-
?
|
|
31
|
-
: isKeyOf(start, oneCharComparators)
|
|
32
|
-
? start
|
|
31
|
+
const shiftComparator = (s, start) => s.scanner.lookaheadIs("=") ? `${start}${s.scanner.shift()}`
|
|
32
|
+
: isKeyOf(start, oneCharComparators) ? start
|
|
33
33
|
: s.error(singleEqualsMessage);
|
|
34
|
-
export const writeUnboundableMessage = (root) => `Bounded expression ${root} must be a number, string, Array, or Date`;
|
|
35
34
|
export const writeIncompatibleRangeMessage = (l, r) => `Bound kinds ${l} and ${r} are incompatible`;
|
|
36
|
-
export const
|
|
37
|
-
|
|
38
|
-
if (root.extends(keywords.number)) {
|
|
35
|
+
export const getBoundKinds = (comparator, limit, root, boundKind) => {
|
|
36
|
+
if (root.extends(tsKeywords.number)) {
|
|
39
37
|
if (typeof limit !== "number") {
|
|
40
|
-
return throwParseError(
|
|
38
|
+
return throwParseError(writeInvalidLimitMessage(comparator, limit, boundKind));
|
|
41
39
|
}
|
|
42
|
-
return comparator === "=="
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
? ["min"]
|
|
46
|
-
: ["max"];
|
|
40
|
+
return (comparator === "==" ? ["min", "max"]
|
|
41
|
+
: comparator[0] === ">" ? ["min"]
|
|
42
|
+
: ["max"]);
|
|
47
43
|
}
|
|
48
|
-
if (root.extends(
|
|
44
|
+
if (root.extends(internalKeywords.lengthBoundable)) {
|
|
49
45
|
if (typeof limit !== "number") {
|
|
50
|
-
return throwParseError(
|
|
46
|
+
return throwParseError(writeInvalidLimitMessage(comparator, limit, boundKind));
|
|
51
47
|
}
|
|
52
|
-
return comparator === "=="
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
? ["minLength"]
|
|
56
|
-
: ["maxLength"];
|
|
48
|
+
return (comparator === "==" ? ["minLength", "maxLength"]
|
|
49
|
+
: comparator[0] === ">" ? ["minLength"]
|
|
50
|
+
: ["maxLength"]);
|
|
57
51
|
}
|
|
58
|
-
if (root.extends(
|
|
52
|
+
if (root.extends(jsObjects.Date)) {
|
|
59
53
|
// allow either numeric or date limits
|
|
60
|
-
return comparator === "=="
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
? ["after"]
|
|
64
|
-
: ["before"];
|
|
54
|
+
return (comparator === "==" ? ["after", "before"]
|
|
55
|
+
: comparator[0] === ">" ? ["after"]
|
|
56
|
+
: ["before"]);
|
|
65
57
|
}
|
|
66
|
-
return throwParseError(writeUnboundableMessage(root.
|
|
58
|
+
return throwParseError(writeUnboundableMessage(root.expression));
|
|
67
59
|
};
|
|
68
|
-
export const singleEqualsMessage =
|
|
69
|
-
const
|
|
70
|
-
|
|
71
|
-
|
|
60
|
+
export const singleEqualsMessage = "= is not a valid comparator. Use == to check for equality";
|
|
61
|
+
const openLeftBoundToRoot = (leftBound) => ({
|
|
62
|
+
rule: isDateLiteral(leftBound.limit) ?
|
|
63
|
+
extractDateLiteralSource(leftBound.limit)
|
|
72
64
|
: leftBound.limit,
|
|
73
65
|
exclusive: leftBound.comparator.length === 1
|
|
74
66
|
});
|
|
@@ -77,30 +69,27 @@ export const parseRightBound = (s, comparator) => {
|
|
|
77
69
|
const previousRoot = s.unsetRoot();
|
|
78
70
|
const previousScannerIndex = s.scanner.location;
|
|
79
71
|
s.parseOperand();
|
|
72
|
+
const limitNode = s.unsetRoot();
|
|
80
73
|
// after parsing the next operand, use the locations to get the
|
|
81
74
|
// token from which it was parsed
|
|
82
75
|
const limitToken = s.scanner.sliceChars(previousScannerIndex, s.scanner.location);
|
|
83
|
-
s.
|
|
84
|
-
|
|
85
|
-
(
|
|
86
|
-
|
|
87
|
-
|
|
76
|
+
s.root = previousRoot;
|
|
77
|
+
if (!limitNode.hasKind("unit") ||
|
|
78
|
+
(typeof limitNode.unit !== "number" && !(limitNode.unit instanceof Date)))
|
|
79
|
+
return s.error(writeInvalidLimitMessage(comparator, limitToken, "right"));
|
|
80
|
+
const limit = limitNode.unit;
|
|
88
81
|
// apply the newly-parsed right bound
|
|
89
82
|
const exclusive = comparator.length === 1;
|
|
90
83
|
// if the comparator is ==, both the min and max of that pair will be applied
|
|
91
|
-
for (const kind of getBoundKinds(comparator, limit, previousRoot))
|
|
92
|
-
s.constrainRoot(kind, { limit, exclusive });
|
|
93
|
-
|
|
94
|
-
if (!s.branches.leftBound) {
|
|
84
|
+
for (const kind of getBoundKinds(comparator, typeof limit === "number" ? limit : limitToken, previousRoot, "right"))
|
|
85
|
+
s.constrainRoot(kind, { rule: limit, exclusive });
|
|
86
|
+
if (!s.branches.leftBound)
|
|
95
87
|
return;
|
|
96
|
-
}
|
|
97
88
|
// if there's an open left bound, perform additional validation and apply it
|
|
98
|
-
if (!isKeyOf(comparator, maxComparators))
|
|
89
|
+
if (!isKeyOf(comparator, maxComparators))
|
|
99
90
|
return s.error(writeUnpairableComparatorMessage(comparator));
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
s.
|
|
103
|
-
delete s.branches.leftBound;
|
|
91
|
+
const lowerBoundKind = getBoundKinds(s.branches.leftBound.comparator, s.branches.leftBound.limit, previousRoot, "left");
|
|
92
|
+
s.constrainRoot(lowerBoundKind[0], openLeftBoundToRoot(s.branches.leftBound));
|
|
93
|
+
s.branches.leftBound = null;
|
|
104
94
|
};
|
|
105
|
-
export const writeInvalidLimitMessage = (comparator, limit, boundKind) => `Comparator ${comparator} must be ${boundKind === "left" ? "preceded" : "followed"} by a corresponding literal (was
|
|
106
|
-
//# sourceMappingURL=bounds.js.map
|
|
95
|
+
export const writeInvalidLimitMessage = (comparator, limit, boundKind) => `Comparator ${boundKind === "left" ? invertedComparators[comparator] : comparator} must be ${boundKind === "left" ? "preceded" : "followed"} by a corresponding literal (was ${limit})`;
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import { type NumberLiteral } from "@arktype/util";
|
|
2
1
|
import type { DynamicStateWithRoot } from "../../reduce/dynamic.js";
|
|
3
2
|
import type { StaticState, state } from "../../reduce/static.js";
|
|
4
3
|
import type { Scanner } from "../scanner.js";
|
|
5
4
|
export declare const parseDivisor: (s: DynamicStateWithRoot) => void;
|
|
6
|
-
export type parseDivisor<s extends StaticState, unscanned extends string> = Scanner.shiftUntilNextTerminator<Scanner.skipWhitespace<unscanned>> extends Scanner.shiftResult<infer scanned, infer nextUnscanned> ? scanned extends
|
|
5
|
+
export type parseDivisor<s extends StaticState, unscanned extends string> = Scanner.shiftUntilNextTerminator<Scanner.skipWhitespace<unscanned>> extends (Scanner.shiftResult<infer scanned, infer nextUnscanned>) ? scanned extends `${infer divisor extends number}` ? divisor extends 0 ? state.error<writeInvalidDivisorMessage<0>> : state.setRoot<s, [s["root"], "%", divisor], nextUnscanned> : state.error<writeInvalidDivisorMessage<scanned>> : never;
|
|
7
6
|
export declare const writeInvalidDivisorMessage: <divisor extends string | number>(divisor: divisor) => `% operator must be followed by a non-zero integer literal (was ${divisor})`;
|
|
8
7
|
export type writeInvalidDivisorMessage<divisor extends string | number> = `% operator must be followed by a non-zero integer literal (was ${divisor})`;
|
|
9
|
-
//# sourceMappingURL=divisor.d.ts.map
|
|
@@ -4,10 +4,8 @@ export const parseDivisor = (s) => {
|
|
|
4
4
|
const divisor = tryParseInteger(divisorToken, {
|
|
5
5
|
errorOnFail: writeInvalidDivisorMessage(divisorToken)
|
|
6
6
|
});
|
|
7
|
-
if (divisor === 0)
|
|
7
|
+
if (divisor === 0)
|
|
8
8
|
s.error(writeInvalidDivisorMessage(0));
|
|
9
|
-
}
|
|
10
9
|
s.root = s.root.constrain("divisor", divisor);
|
|
11
10
|
};
|
|
12
11
|
export const writeInvalidDivisorMessage = (divisor) => `% operator must be followed by a non-zero integer literal (was ${divisor})`;
|
|
13
|
-
//# sourceMappingURL=divisor.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { DynamicStateWithRoot } from "../../reduce/dynamic.js";
|
|
2
|
-
import type {
|
|
2
|
+
import type { StaticState, state } from "../../reduce/static.js";
|
|
3
3
|
import { Scanner } from "../scanner.js";
|
|
4
4
|
import { parseBound, type ComparatorStartChar } from "./bounds.js";
|
|
5
5
|
import { parseDivisor } from "./divisor.js";
|
|
@@ -10,4 +10,3 @@ export type writeUnexpectedCharacterMessage<char extends string, shouldBe extend
|
|
|
10
10
|
export declare const incompleteArrayTokenMessage = "Missing expected ']'";
|
|
11
11
|
type incompleteArrayTokenMessage = typeof incompleteArrayTokenMessage;
|
|
12
12
|
export {};
|
|
13
|
-
//# sourceMappingURL=operator.d.ts.map
|
|
@@ -4,26 +4,19 @@ import { comparatorStartChars, parseBound } from "./bounds.js";
|
|
|
4
4
|
import { parseDivisor } from "./divisor.js";
|
|
5
5
|
export const parseOperator = (s) => {
|
|
6
6
|
const lookahead = s.scanner.shift();
|
|
7
|
-
return lookahead === ""
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
? s.setRoot(s.root.array())
|
|
7
|
+
return (lookahead === "" ? s.finalize("")
|
|
8
|
+
: lookahead === "[" ?
|
|
9
|
+
s.scanner.shift() === "]" ?
|
|
10
|
+
s.setRoot(s.root.array())
|
|
12
11
|
: s.error(incompleteArrayTokenMessage)
|
|
13
|
-
: lookahead === "|" || lookahead === "&"
|
|
14
|
-
? s.
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
: lookahead === "%"
|
|
22
|
-
? parseDivisor(s)
|
|
23
|
-
: lookahead === " "
|
|
24
|
-
? parseOperator(s)
|
|
25
|
-
: s.error(writeUnexpectedCharacterMessage(lookahead));
|
|
12
|
+
: lookahead === "|" || lookahead === "&" ? s.pushRootToBranch(lookahead)
|
|
13
|
+
: lookahead === ")" ? s.finalizeGroup()
|
|
14
|
+
: Scanner.lookaheadIsFinalizing(lookahead, s.scanner.unscanned) ?
|
|
15
|
+
s.finalize(lookahead)
|
|
16
|
+
: isKeyOf(lookahead, comparatorStartChars) ? parseBound(s, lookahead)
|
|
17
|
+
: lookahead === "%" ? parseDivisor(s)
|
|
18
|
+
: lookahead === " " ? parseOperator(s)
|
|
19
|
+
: s.error(writeUnexpectedCharacterMessage(lookahead)));
|
|
26
20
|
};
|
|
27
21
|
export const writeUnexpectedCharacterMessage = (char, shouldBe = "") => `'${char}' is not allowed here${shouldBe && ` (should be ${shouldBe})`}`;
|
|
28
22
|
export const incompleteArrayTokenMessage = `Missing expected ']'`;
|
|
29
|
-
//# sourceMappingURL=operator.js.map
|
|
@@ -54,10 +54,11 @@ export declare namespace Scanner {
|
|
|
54
54
|
const whiteSpaceTokens: {
|
|
55
55
|
readonly " ": true;
|
|
56
56
|
readonly "\n": true;
|
|
57
|
+
readonly "\t": true;
|
|
57
58
|
};
|
|
58
59
|
type WhiteSpaceToken = keyof typeof whiteSpaceTokens;
|
|
59
60
|
const lookaheadIsFinalizing: (lookahead: string, unscanned: string) => lookahead is ">" | ",";
|
|
60
|
-
type lookaheadIsFinalizing<lookahead extends string, unscanned extends string> = lookahead extends ">" ? unscanned extends `=${infer nextUnscanned}` ? nextUnscanned extends `=${string}` ? true : false : Scanner.skipWhitespace<unscanned> extends "" | `${TerminatingChar}${string}` ? true : false : lookahead extends "," ? true : false;
|
|
61
|
+
type lookaheadIsFinalizing<lookahead extends string, unscanned extends string> = lookahead extends ">" ? unscanned extends `=${infer nextUnscanned}` ? nextUnscanned extends `=${string}` ? true : false : Scanner.skipWhitespace<unscanned> extends ("" | `${TerminatingChar}${string}`) ? true : false : lookahead extends "," ? true : false;
|
|
61
62
|
type shift<lookahead extends string, unscanned extends string> = `${lookahead}${unscanned}`;
|
|
62
63
|
type shiftUntil<unscanned extends string, terminator extends string, scanned extends string = ""> = unscanned extends shift<infer lookahead, infer nextUnscanned> ? lookahead extends terminator ? scanned extends `${infer base}${EscapeToken}` ? shiftUntil<nextUnscanned, terminator, `${base}${lookahead}`> : [scanned, unscanned] : shiftUntil<nextUnscanned, terminator, `${scanned}${lookahead}`> : [scanned, ""];
|
|
63
64
|
type shiftUntilNot<unscanned extends string, nonTerminator extends string, scanned extends string = ""> = unscanned extends shift<infer lookahead, infer nextUnscanned> ? lookahead extends nonTerminator ? shiftUntilNot<nextUnscanned, nonTerminator, `${scanned}${lookahead}`> : [scanned, unscanned] : [scanned, ""];
|
|
@@ -68,4 +69,3 @@ export declare namespace Scanner {
|
|
|
68
69
|
unscanned
|
|
69
70
|
];
|
|
70
71
|
}
|
|
71
|
-
//# sourceMappingURL=scanner.d.ts.map
|
|
@@ -20,12 +20,10 @@ export class Scanner {
|
|
|
20
20
|
let shifted = "";
|
|
21
21
|
while (this.lookahead) {
|
|
22
22
|
if (condition(this, shifted)) {
|
|
23
|
-
if (shifted[shifted.length - 1] === Scanner.escapeToken)
|
|
23
|
+
if (shifted[shifted.length - 1] === Scanner.escapeToken)
|
|
24
24
|
shifted = shifted.slice(0, -1);
|
|
25
|
-
|
|
26
|
-
else {
|
|
25
|
+
else
|
|
27
26
|
break;
|
|
28
|
-
}
|
|
29
27
|
}
|
|
30
28
|
shifted += this.shift();
|
|
31
29
|
}
|
|
@@ -83,17 +81,17 @@ export class Scanner {
|
|
|
83
81
|
Scanner.escapeToken = "\\";
|
|
84
82
|
Scanner.whiteSpaceTokens = {
|
|
85
83
|
" ": true,
|
|
86
|
-
"\n": true
|
|
84
|
+
"\n": true,
|
|
85
|
+
"\t": true
|
|
87
86
|
};
|
|
88
|
-
Scanner.lookaheadIsFinalizing = (lookahead, unscanned) => lookahead === ">"
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
87
|
+
Scanner.lookaheadIsFinalizing = (lookahead, unscanned) => lookahead === ">" ?
|
|
88
|
+
unscanned[0] === "=" ?
|
|
89
|
+
// >== would only occur in an expression like Array<number>==5
|
|
90
|
+
// otherwise, >= would only occur as part of a bound like number>=5
|
|
91
|
+
unscanned[1] === "="
|
|
92
|
+
// if > is the end of a generic instantiation, the next token will be an operator or the end of the string
|
|
93
|
+
: unscanned.trimStart() === "" ||
|
|
94
|
+
isKeyOf(unscanned.trimStart()[0], Scanner.terminatingChars)
|
|
95
|
+
// if the lookahead is a finalizing token but not >, it's unambiguously a finalizer (currently just ",")
|
|
96
|
+
: lookahead === ",";
|
|
98
97
|
})(Scanner || (Scanner = {}));
|
|
99
|
-
//# sourceMappingURL=scanner.js.map
|
|
@@ -1,19 +1,22 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { BaseRoot } from "@arktype/schema";
|
|
2
2
|
import { type ErrorMessage } from "@arktype/util";
|
|
3
|
-
import type { inferAstRoot } from "../semantic/
|
|
3
|
+
import type { inferAstRoot } from "../semantic/infer.js";
|
|
4
4
|
import type { DynamicState, DynamicStateWithRoot } from "./reduce/dynamic.js";
|
|
5
5
|
import type { StringifiablePrefixOperator } from "./reduce/shared.js";
|
|
6
6
|
import type { StaticState, state } from "./reduce/static.js";
|
|
7
7
|
import type { parseOperand } from "./shift/operand/operand.js";
|
|
8
|
-
import {
|
|
8
|
+
import { type parseOperator, writeUnexpectedCharacterMessage } from "./shift/operator/operator.js";
|
|
9
9
|
/**
|
|
10
10
|
* Try to parse the definition from right to left using the most common syntax.
|
|
11
11
|
* This can be much more efficient for simple definitions.
|
|
12
12
|
*/
|
|
13
|
-
export type parseString<def extends string, $, args> = def extends keyof $ ? def : def extends `${infer child}[]` ? child extends keyof $ ? [
|
|
13
|
+
export type parseString<def extends string, $, args> = def extends keyof $ ? def : def extends `${infer child}[]` ? child extends keyof $ ? [
|
|
14
|
+
child,
|
|
15
|
+
"[]"
|
|
16
|
+
] : fullStringParse<state.initialize<def>, $, args> : fullStringParse<state.initialize<def>, $, args>;
|
|
14
17
|
export type inferString<def extends string, $, args> = inferAstRoot<parseString<def, $, args>, $, args>;
|
|
15
18
|
export type BaseCompletions<$, args, otherSuggestions extends string = never> = (keyof $ & string) | (keyof args & string) | StringifiablePrefixOperator | otherSuggestions;
|
|
16
|
-
export declare const fullStringParse: (s: DynamicState) =>
|
|
19
|
+
export declare const fullStringParse: (s: DynamicState) => BaseRoot;
|
|
17
20
|
type fullStringParse<s extends StaticState, $, args> = extractFinalizedResult<parseUntilFinalizer<s, $, args>>;
|
|
18
21
|
export declare const parseUntilFinalizer: (s: DynamicState) => DynamicStateWithRoot;
|
|
19
22
|
export type parseUntilFinalizer<s extends StaticState, $, args> = s["finalizer"] extends undefined ? parseUntilFinalizer<next<s, $, args>, $, args> : s;
|
|
@@ -21,4 +24,3 @@ declare const next: (s: DynamicState) => void;
|
|
|
21
24
|
type next<s extends StaticState, $, args> = s["root"] extends undefined ? parseOperand<s, $, args> : parseOperator<s, $, args>;
|
|
22
25
|
export type extractFinalizedResult<s extends StaticState> = s["finalizer"] extends ErrorMessage ? s["finalizer"] : s["finalizer"] extends "" ? s["root"] : state.error<writeUnexpectedCharacterMessage<`${s["finalizer"]}`>>;
|
|
23
26
|
export {};
|
|
24
|
-
//# sourceMappingURL=string.d.ts.map
|
|
@@ -14,10 +14,8 @@ export const fullStringParse = (s) => {
|
|
|
14
14
|
return result;
|
|
15
15
|
};
|
|
16
16
|
export const parseUntilFinalizer = (s) => {
|
|
17
|
-
while (s.finalizer === undefined)
|
|
17
|
+
while (s.finalizer === undefined)
|
|
18
18
|
next(s);
|
|
19
|
-
}
|
|
20
19
|
return s;
|
|
21
20
|
};
|
|
22
21
|
const next = (s) => s.hasRoot() ? s.parseOperator() : s.parseOperand();
|
|
23
|
-
//# sourceMappingURL=string.js.map
|
package/out/parser/tuple.d.ts
CHANGED
|
@@ -1,58 +1,119 @@
|
|
|
1
|
-
import { type BaseMeta, type Morph, type Out, type Predicate, type
|
|
2
|
-
import { type Constructor, type Domain, type
|
|
1
|
+
import { type BaseMeta, type BaseRoot, type Morph, type Out, type Predicate, type distillConstrainableIn, type distillConstrainableOut, type inferIntersection, type inferMorphOut, type inferNarrow } from "@arktype/schema";
|
|
2
|
+
import { type Constructor, type Domain, type ErrorMessage, type array, type conform, type show } from "@arktype/util";
|
|
3
3
|
import type { ParseContext } from "../scope.js";
|
|
4
4
|
import type { inferDefinition, validateDefinition } from "./definition.js";
|
|
5
|
-
import type {
|
|
6
|
-
import type { InfixOperator, PostfixExpression } from "./semantic/semantic.js";
|
|
7
|
-
import { parseEntry, type EntryParseResult, type validateObjectValue } from "./shared.js";
|
|
5
|
+
import type { InfixOperator, PostfixExpression } from "./semantic/infer.js";
|
|
8
6
|
import { writeMissingRightOperandMessage } from "./string/shift/operand/unenclosed.js";
|
|
9
7
|
import type { BaseCompletions } from "./string/string.js";
|
|
10
|
-
export declare const parseTuple: (def:
|
|
11
|
-
export declare const parseTupleLiteral: (def:
|
|
12
|
-
export declare const maybeParseTupleExpression: (def: List, ctx: ParseContext) => TypeNode | undefined;
|
|
8
|
+
export declare const parseTuple: (def: array, ctx: ParseContext) => BaseRoot;
|
|
9
|
+
export declare const parseTupleLiteral: (def: array, ctx: ParseContext) => BaseRoot;
|
|
13
10
|
type InfixExpression = readonly [unknown, InfixOperator, ...unknown[]];
|
|
14
|
-
export type validateTuple<def extends
|
|
15
|
-
def[0] extends "" ? BaseCompletions<$, args, IndexZeroOperator> : def[0],
|
|
16
|
-
def[1] extends "" ? BaseCompletions<$, args, IndexOneOperator> : def[1]
|
|
11
|
+
export type validateTuple<def extends array, $, args> = def extends IndexZeroExpression ? validatePrefixExpression<def, $, args> : def extends PostfixExpression ? validatePostfixExpression<def, $, args> : def extends InfixExpression ? validateInfixExpression<def, $, args> : def extends (readonly ["", ...unknown[]] | readonly [unknown, "", ...unknown[]]) ? readonly [
|
|
12
|
+
def[0] extends "" ? BaseCompletions<$, args, IndexZeroOperator | "..."> : def[0],
|
|
13
|
+
def[1] extends "" ? BaseCompletions<$, args, IndexOneOperator | "..." | "?"> : def[1]
|
|
17
14
|
] : validateTupleLiteral<def, $, args>;
|
|
18
|
-
export type validateTupleLiteral<def extends
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
type
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
type
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
15
|
+
export type validateTupleLiteral<def extends array, $, args> = parseSequence<def, $, args> extends infer s extends SequenceParseState ? Readonly<s["validated"]> : never;
|
|
16
|
+
type inferTupleLiteral<def extends array, $, args> = parseSequence<def, $, args> extends infer s extends SequenceParseState ? s["inferred"] : never;
|
|
17
|
+
type SequenceParseState = {
|
|
18
|
+
unscanned: array;
|
|
19
|
+
inferred: array;
|
|
20
|
+
validated: array;
|
|
21
|
+
};
|
|
22
|
+
type parseSequence<def extends array, $, args> = parseNextElement<{
|
|
23
|
+
unscanned: def;
|
|
24
|
+
inferred: [];
|
|
25
|
+
validated: [];
|
|
26
|
+
}, $, args>;
|
|
27
|
+
type PreparsedElement = {
|
|
28
|
+
head: unknown;
|
|
29
|
+
tail: array;
|
|
30
|
+
optional: boolean;
|
|
31
|
+
spread: boolean;
|
|
32
|
+
};
|
|
33
|
+
declare namespace PreparsedElement {
|
|
34
|
+
type from<result extends PreparsedElement> = result;
|
|
35
|
+
}
|
|
36
|
+
type preparseNextElement<s extends SequenceParseState> = s["unscanned"] extends readonly ["...", infer head, ...infer tail] ? tail extends readonly ["?", ...infer postOptionalTail] ? PreparsedElement.from<{
|
|
37
|
+
head: head;
|
|
38
|
+
tail: postOptionalTail;
|
|
39
|
+
optional: true;
|
|
40
|
+
spread: true;
|
|
41
|
+
}> : PreparsedElement.from<{
|
|
42
|
+
head: head;
|
|
43
|
+
tail: tail;
|
|
44
|
+
optional: false;
|
|
45
|
+
spread: true;
|
|
46
|
+
}> : s["unscanned"] extends readonly [infer head, "?", ...infer tail] ? PreparsedElement.from<{
|
|
47
|
+
head: head;
|
|
48
|
+
tail: tail;
|
|
49
|
+
optional: true;
|
|
50
|
+
spread: false;
|
|
51
|
+
}> : s["unscanned"] extends readonly [infer head, ...infer tail] ? PreparsedElement.from<{
|
|
52
|
+
head: head;
|
|
53
|
+
tail: tail;
|
|
54
|
+
optional: false;
|
|
55
|
+
spread: false;
|
|
56
|
+
}> : null;
|
|
57
|
+
type parseNextElement<s extends SequenceParseState, $, args> = preparseNextElement<s> extends infer next extends PreparsedElement ? parseNextElement<{
|
|
58
|
+
unscanned: next["tail"];
|
|
59
|
+
inferred: next["spread"] extends true ? [
|
|
60
|
+
...s["inferred"],
|
|
61
|
+
...conform<inferDefinition<next["head"], $, args>, array>
|
|
62
|
+
] : next["optional"] extends true ? [
|
|
63
|
+
...s["inferred"],
|
|
64
|
+
inferDefinition<next["head"], $, args>?
|
|
65
|
+
] : [...s["inferred"], inferDefinition<next["head"], $, args>];
|
|
66
|
+
validated: [
|
|
67
|
+
...s["validated"],
|
|
68
|
+
...(next["spread"] extends true ? [
|
|
69
|
+
inferDefinition<next["head"], $, args> extends (infer spreadOperand extends array) ? [
|
|
70
|
+
number,
|
|
71
|
+
number
|
|
72
|
+
] extends ([
|
|
73
|
+
s["inferred"]["length"],
|
|
74
|
+
spreadOperand["length"]
|
|
75
|
+
]) ? ErrorMessage<multipleVariadicMessage> : "..." : ErrorMessage<writeNonArraySpreadMessage<next["head"]>>
|
|
76
|
+
] : []),
|
|
77
|
+
[
|
|
78
|
+
next["optional"] | next["spread"],
|
|
79
|
+
"?"
|
|
80
|
+
] extends ([
|
|
81
|
+
false,
|
|
82
|
+
s["validated"][number]
|
|
83
|
+
]) ? ErrorMessage<requiredPostOptionalMessage> : validateDefinition<next["head"], $, args>,
|
|
84
|
+
...(next["optional"] extends true ? [
|
|
85
|
+
next["spread"] extends true ? ErrorMessage<spreadOptionalMessage> : number extends s["inferred"]["length"] ? ErrorMessage<optionalPostVariadicMessage> : "?"
|
|
86
|
+
] : [])
|
|
87
|
+
];
|
|
88
|
+
}, $, args> : s;
|
|
89
|
+
export declare const writeNonArraySpreadMessage: <operand extends string>(operand: operand) => `Spread element must be an array${operand extends string ? ` (was ${operand})` : ""}`;
|
|
90
|
+
type writeNonArraySpreadMessage<operand> = `Spread element must be an array${operand extends string ? ` (was ${operand})` : ""}`;
|
|
91
|
+
export declare const multipleVariadicMesage = "A tuple may have at most one variadic element";
|
|
92
|
+
type multipleVariadicMessage = typeof multipleVariadicMesage;
|
|
93
|
+
export declare const requiredPostOptionalMessage = "A required element may not follow an optional element";
|
|
94
|
+
type requiredPostOptionalMessage = typeof requiredPostOptionalMessage;
|
|
95
|
+
export declare const optionalPostVariadicMessage = "An optional element may not follow a variadic element";
|
|
96
|
+
type optionalPostVariadicMessage = typeof optionalPostVariadicMessage;
|
|
97
|
+
export declare const spreadOptionalMessage = "A spread element cannot be optional";
|
|
98
|
+
type spreadOptionalMessage = typeof optionalPostVariadicMessage;
|
|
99
|
+
export type inferTuple<def extends array, $, args> = def extends TupleExpression ? inferTupleExpression<def, $, args> : inferTupleLiteral<def, $, args>;
|
|
100
|
+
export type inferTupleExpression<def extends TupleExpression, $, args> = def[1] extends "[]" ? inferDefinition<def[0], $, args>[] : def[1] extends "&" ? inferIntersection<inferDefinition<def[0], $, args>, inferDefinition<def[2], $, args>> : def[1] extends "|" ? inferDefinition<def[0], $, args> | inferDefinition<def[2], $, args> : def[1] extends ":" ? inferNarrow<inferDefinition<def[0], $, args>, def[2]> : def[1] extends "=>" ? parseMorph<def[0], def[2], $, args> : def[1] extends "@" ? inferDefinition<def[0], $, args> : def extends readonly ["===", ...infer values] ? values[number] : def extends (readonly ["instanceof", ...infer constructors extends Constructor[]]) ? InstanceType<constructors[number]> : def[0] extends "keyof" ? inferKeyOfExpression<def[1], $, args> : never;
|
|
40
101
|
export type validatePrefixExpression<def extends IndexZeroExpression, $, args> = def["length"] extends 1 ? readonly [writeMissingRightOperandMessage<def[0]>] : def[0] extends "keyof" ? readonly [def[0], validateDefinition<def[1], $, args>] : def[0] extends "===" ? readonly [def[0], ...unknown[]] : def[0] extends "instanceof" ? readonly [def[0], ...Constructor[]] : never;
|
|
41
102
|
export type validatePostfixExpression<def extends PostfixExpression, $, args> = conform<def, readonly [validateDefinition<def[0], $, args>, "[]"]>;
|
|
42
103
|
export type validateInfixExpression<def extends InfixExpression, $, args> = def["length"] extends 2 ? readonly [def[0], writeMissingRightOperandMessage<def[1]>] : readonly [
|
|
43
104
|
validateDefinition<def[0], $, args>,
|
|
44
105
|
def[1],
|
|
45
|
-
def[1] extends "|" ? validateDefinition<def[2], $, args> : def[1] extends "&" ? validateDefinition<def[2], $, args> : def[1] extends ":" ? Predicate<
|
|
106
|
+
def[1] extends "|" ? validateDefinition<def[2], $, args> : def[1] extends "&" ? validateDefinition<def[2], $, args> : def[1] extends ":" ? Predicate<distillConstrainableIn<inferDefinition<def[0], $, args>>> : def[1] extends "=>" ? Morph<distillConstrainableOut<inferDefinition<def[0], $, args>>, unknown> : def[1] extends "@" ? BaseMeta | string : validateDefinition<def[2], $, args>
|
|
46
107
|
];
|
|
47
108
|
export type UnparsedTupleExpressionInput = {
|
|
48
109
|
instanceof: Constructor;
|
|
49
110
|
"===": unknown;
|
|
50
111
|
};
|
|
51
|
-
export type UnparsedTupleOperator =
|
|
112
|
+
export type UnparsedTupleOperator = show<keyof UnparsedTupleExpressionInput>;
|
|
52
113
|
export declare const parseKeyOfTuple: PrefixParser<"keyof">;
|
|
53
|
-
export type inferKeyOfExpression<operandDef, $, args> =
|
|
54
|
-
export type PostfixParser<token extends IndexOneOperator> = (def: IndexOneExpression<token>, ctx: ParseContext) =>
|
|
55
|
-
export type PrefixParser<token extends IndexZeroOperator> = (def: IndexZeroExpression<token>, ctx: ParseContext) =>
|
|
114
|
+
export type inferKeyOfExpression<operandDef, $, args> = show<keyof inferDefinition<operandDef, $, args>>;
|
|
115
|
+
export type PostfixParser<token extends IndexOneOperator> = (def: IndexOneExpression<token>, ctx: ParseContext) => BaseRoot;
|
|
116
|
+
export type PrefixParser<token extends IndexZeroOperator> = (def: IndexZeroExpression<token>, ctx: ParseContext) => BaseRoot;
|
|
56
117
|
export type TupleExpression = IndexZeroExpression | IndexOneExpression;
|
|
57
118
|
export type TupleExpressionOperator = IndexZeroOperator | IndexOneOperator;
|
|
58
119
|
export type IndexOneOperator = TuplePostfixOperator | TupleInfixOperator;
|
|
@@ -60,12 +121,10 @@ export type TuplePostfixOperator = "[]";
|
|
|
60
121
|
export type TupleInfixOperator = "&" | "|" | "=>" | ":" | "@";
|
|
61
122
|
export type IndexOneExpression<token extends IndexOneOperator = IndexOneOperator> = readonly [unknown, token, ...unknown[]];
|
|
62
123
|
export declare const parseMorphTuple: PostfixParser<"=>">;
|
|
63
|
-
export declare const writeMalformedFunctionalExpressionMessage: (operator:
|
|
64
|
-
export type parseMorph<inDef, morph, $, args> = morph extends Morph ? (In:
|
|
124
|
+
export declare const writeMalformedFunctionalExpressionMessage: (operator: ":" | "=>", value: unknown) => string;
|
|
125
|
+
export type parseMorph<inDef, morph, $, args> = morph extends Morph ? (In: distillConstrainableIn<inferDefinition<inDef, $, args>>) => Out<inferMorphOut<morph>> : never;
|
|
65
126
|
export declare const parseNarrowTuple: PostfixParser<":">;
|
|
66
|
-
export type FunctionalTupleOperator = ":" | "=>";
|
|
67
127
|
export type IndexZeroOperator = "keyof" | "instanceof" | "===";
|
|
68
128
|
export type IndexZeroExpression<token extends IndexZeroOperator = IndexZeroOperator> = readonly [token, ...unknown[]];
|
|
69
|
-
export declare const writeInvalidConstructorMessage: <actual extends
|
|
129
|
+
export declare const writeInvalidConstructorMessage: <actual extends Domain | keyof import("@arktype/util").builtinConstructors>(actual: actual) => string;
|
|
70
130
|
export {};
|
|
71
|
-
//# sourceMappingURL=tuple.d.ts.map
|