arktype 2.0.0-rc.3 → 2.0.0-rc.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (176) hide show
  1. package/out/attributes.d.ts +94 -0
  2. package/out/attributes.js +3 -0
  3. package/out/config.d.ts +1 -1
  4. package/out/generic.d.ts +55 -58
  5. package/out/generic.js +6 -8
  6. package/out/index.d.ts +6 -4
  7. package/out/index.js +4 -3
  8. package/out/keywords/{constructors/Array.d.ts → Array.d.ts} +3 -3
  9. package/out/keywords/{constructors/Array.js → Array.js} +7 -7
  10. package/out/keywords/{constructors/FormData.d.ts → FormData.d.ts} +3 -3
  11. package/out/keywords/{constructors/FormData.js → FormData.js} +8 -8
  12. package/out/keywords/{constructors/TypedArray.d.ts → TypedArray.d.ts} +1 -1
  13. package/out/keywords/{constructors/TypedArray.js → TypedArray.js} +2 -2
  14. package/out/keywords/builtins.js +2 -2
  15. package/out/keywords/{constructors/constructors.d.ts → constructors.d.ts} +1 -2
  16. package/out/keywords/{constructors/constructors.js → constructors.js} +2 -2
  17. package/out/keywords/keywords.d.ts +61 -0
  18. package/out/keywords/keywords.js +29 -0
  19. package/out/keywords/number.d.ts +23 -0
  20. package/out/keywords/{number/epoch.js → number.js} +24 -2
  21. package/out/keywords/string.d.ts +327 -0
  22. package/out/keywords/string.js +398 -0
  23. package/out/keywords/ts.d.ts +42 -4
  24. package/out/keywords/ts.js +24 -7
  25. package/out/methods/array.d.ts +12 -0
  26. package/out/methods/base.d.ts +178 -0
  27. package/out/methods/date.d.ts +10 -0
  28. package/out/methods/instantiate.d.ts +17 -0
  29. package/out/methods/morph.d.ts +12 -0
  30. package/out/methods/number.d.ts +11 -0
  31. package/out/methods/object.d.ts +106 -0
  32. package/out/methods/string.d.ts +12 -0
  33. package/out/module.d.ts +2 -2
  34. package/out/parser/{semantic → ast}/bounds.d.ts +3 -3
  35. package/out/parser/ast/default.d.ts +8 -0
  36. package/out/parser/ast/generic.d.ts +17 -0
  37. package/out/parser/ast/infer.d.ts +25 -0
  38. package/out/parser/{semantic → ast}/utils.d.ts +1 -1
  39. package/out/parser/ast/validate.d.ts +30 -0
  40. package/out/parser/ast/validate.js +3 -0
  41. package/out/parser/definition.d.ts +21 -13
  42. package/out/parser/definition.js +20 -2
  43. package/out/parser/objectLiteral.d.ts +41 -67
  44. package/out/parser/objectLiteral.js +84 -71
  45. package/out/parser/property.d.ts +36 -0
  46. package/out/parser/property.js +16 -0
  47. package/out/parser/{string/reduce → reduce}/dynamic.d.ts +10 -13
  48. package/out/parser/{string/reduce → reduce}/dynamic.js +5 -6
  49. package/out/parser/{string/reduce → reduce}/shared.d.ts +1 -1
  50. package/out/parser/{string/reduce → reduce}/static.d.ts +4 -4
  51. package/out/parser/{string/shift → shift}/operand/date.d.ts +3 -1
  52. package/out/parser/{string/shift → shift}/operand/enclosed.d.ts +4 -4
  53. package/out/parser/{string/shift → shift}/operand/enclosed.js +7 -3
  54. package/out/parser/shift/operand/operand.d.ts +9 -0
  55. package/out/parser/{string/shift → shift}/operand/operand.js +2 -2
  56. package/out/parser/{string/shift → shift}/operand/unenclosed.d.ts +15 -7
  57. package/out/parser/{string/shift → shift}/operand/unenclosed.js +12 -7
  58. package/out/parser/{string/shift → shift}/operator/bounds.d.ts +7 -7
  59. package/out/parser/{string/shift → shift}/operator/bounds.js +5 -4
  60. package/out/parser/shift/operator/brand.d.ts +6 -0
  61. package/out/parser/shift/operator/brand.js +5 -0
  62. package/out/parser/{string/shift → shift}/operator/default.d.ts +4 -6
  63. package/out/parser/{string/shift → shift}/operator/default.js +4 -6
  64. package/out/parser/{string/shift → shift}/operator/divisor.d.ts +2 -2
  65. package/out/parser/shift/operator/operator.d.ts +14 -0
  66. package/out/parser/{string/shift → shift}/operator/operator.js +7 -5
  67. package/out/parser/shift/scanner.d.ts +47 -0
  68. package/out/parser/shift/scanner.js +43 -0
  69. package/out/parser/{string/string.d.ts → string.d.ts} +9 -9
  70. package/out/parser/{string/string.js → string.js} +19 -0
  71. package/out/parser/tupleExpressions.d.ts +47 -0
  72. package/out/parser/tupleExpressions.js +67 -0
  73. package/out/parser/tupleLiteral.d.ts +95 -0
  74. package/out/parser/tupleLiteral.js +122 -0
  75. package/out/scope.d.ts +41 -34
  76. package/out/scope.js +54 -62
  77. package/out/type.d.ts +46 -22
  78. package/out/type.js +15 -11
  79. package/package.json +3 -3
  80. package/out/intersect.d.ts +0 -28
  81. package/out/keys.d.ts +0 -16
  82. package/out/keywords/ark.d.ts +0 -39
  83. package/out/keywords/ark.js +0 -24
  84. package/out/keywords/ast.d.ts +0 -193
  85. package/out/keywords/ast.js +0 -2
  86. package/out/keywords/number/epoch.d.ts +0 -10
  87. package/out/keywords/number/integer.d.ts +0 -3
  88. package/out/keywords/number/integer.js +0 -5
  89. package/out/keywords/number/number.d.ts +0 -28
  90. package/out/keywords/number/number.js +0 -9
  91. package/out/keywords/string/alpha.d.ts +0 -7
  92. package/out/keywords/string/alpha.js +0 -2
  93. package/out/keywords/string/alphanumeric.d.ts +0 -7
  94. package/out/keywords/string/alphanumeric.js +0 -2
  95. package/out/keywords/string/capitalize.d.ts +0 -15
  96. package/out/keywords/string/capitalize.js +0 -12
  97. package/out/keywords/string/creditCard.d.ts +0 -8
  98. package/out/keywords/string/creditCard.js +0 -37
  99. package/out/keywords/string/date.d.ts +0 -59
  100. package/out/keywords/string/date.js +0 -98
  101. package/out/keywords/string/digits.d.ts +0 -7
  102. package/out/keywords/string/digits.js +0 -2
  103. package/out/keywords/string/email.d.ts +0 -7
  104. package/out/keywords/string/email.js +0 -4
  105. package/out/keywords/string/integer.d.ts +0 -16
  106. package/out/keywords/string/integer.js +0 -16
  107. package/out/keywords/string/ip.d.ts +0 -20
  108. package/out/keywords/string/ip.js +0 -23
  109. package/out/keywords/string/json.d.ts +0 -15
  110. package/out/keywords/string/json.js +0 -45
  111. package/out/keywords/string/lower.d.ts +0 -15
  112. package/out/keywords/string/lower.js +0 -12
  113. package/out/keywords/string/normalize.d.ts +0 -92
  114. package/out/keywords/string/normalize.js +0 -43
  115. package/out/keywords/string/numeric.d.ts +0 -15
  116. package/out/keywords/string/numeric.js +0 -13
  117. package/out/keywords/string/semver.d.ts +0 -7
  118. package/out/keywords/string/semver.js +0 -4
  119. package/out/keywords/string/string.d.ts +0 -112
  120. package/out/keywords/string/string.js +0 -41
  121. package/out/keywords/string/trim.d.ts +0 -15
  122. package/out/keywords/string/trim.js +0 -14
  123. package/out/keywords/string/upper.d.ts +0 -15
  124. package/out/keywords/string/upper.js +0 -12
  125. package/out/keywords/string/url.d.ts +0 -15
  126. package/out/keywords/string/url.js +0 -37
  127. package/out/keywords/string/utils.d.ts +0 -2
  128. package/out/keywords/string/utils.js +0 -10
  129. package/out/keywords/string/uuid.d.ts +0 -42
  130. package/out/keywords/string/uuid.js +0 -19
  131. package/out/keywords/utils.d.ts +0 -1
  132. package/out/keywords/utils.js +0 -2
  133. package/out/parser/semantic/default.d.ts +0 -9
  134. package/out/parser/semantic/default.js +0 -1
  135. package/out/parser/semantic/infer.d.ts +0 -39
  136. package/out/parser/semantic/validate.d.ts +0 -26
  137. package/out/parser/semantic/validate.js +0 -1
  138. package/out/parser/string/shift/operand/operand.d.ts +0 -9
  139. package/out/parser/string/shift/operator/operator.d.ts +0 -13
  140. package/out/parser/string/shift/scanner.d.ts +0 -69
  141. package/out/parser/string/shift/scanner.js +0 -100
  142. package/out/parser/tuple.d.ts +0 -132
  143. package/out/parser/tuple.js +0 -158
  144. package/out/subtypes/array.d.ts +0 -13
  145. package/out/subtypes/base.d.ts +0 -85
  146. package/out/subtypes/date.d.ts +0 -11
  147. package/out/subtypes/instantiate.d.ts +0 -16
  148. package/out/subtypes/morph.d.ts +0 -13
  149. package/out/subtypes/number.d.ts +0 -12
  150. package/out/subtypes/object.d.ts +0 -33
  151. package/out/subtypes/string.d.ts +0 -13
  152. package/out/subtypes/validator.d.ts +0 -11
  153. package/out/subtypes/validator.js +0 -1
  154. /package/out/{subtypes → methods}/array.js +0 -0
  155. /package/out/{subtypes → methods}/base.js +0 -0
  156. /package/out/{subtypes → methods}/date.js +0 -0
  157. /package/out/{subtypes → methods}/instantiate.js +0 -0
  158. /package/out/{subtypes → methods}/morph.js +0 -0
  159. /package/out/{subtypes → methods}/number.js +0 -0
  160. /package/out/{subtypes → methods}/object.js +0 -0
  161. /package/out/{subtypes → methods}/string.js +0 -0
  162. /package/out/parser/{semantic → ast}/bounds.js +0 -0
  163. /package/out/{intersect.js → parser/ast/default.js} +0 -0
  164. /package/out/parser/{semantic → ast}/divisor.d.ts +0 -0
  165. /package/out/parser/{semantic → ast}/divisor.js +0 -0
  166. /package/out/{keys.js → parser/ast/generic.js} +0 -0
  167. /package/out/parser/{semantic → ast}/infer.js +0 -0
  168. /package/out/parser/{semantic → ast}/keyof.d.ts +0 -0
  169. /package/out/parser/{semantic → ast}/keyof.js +0 -0
  170. /package/out/parser/{semantic → ast}/utils.js +0 -0
  171. /package/out/parser/{string/reduce → reduce}/shared.js +0 -0
  172. /package/out/parser/{string/reduce → reduce}/static.js +0 -0
  173. /package/out/parser/{string/shift → shift}/operand/date.js +0 -0
  174. /package/out/parser/{string/shift → shift}/operand/genericArgs.d.ts +0 -0
  175. /package/out/parser/{string/shift → shift}/operand/genericArgs.js +0 -0
  176. /package/out/parser/{string/shift → shift}/operator/divisor.js +0 -0
@@ -1,15 +0,0 @@
1
- import type { Module, Submodule } from "../../module.ts";
2
- import type { Branded, constrain, To } from "../ast.ts";
3
- declare namespace string {
4
- type uppercase = constrain<string, Branded<"uppercase">>;
5
- }
6
- export declare const upper: upper.module;
7
- export declare namespace upper {
8
- type module = Module<submodule>;
9
- type submodule = Submodule<$>;
10
- type $ = {
11
- $root: (In: string) => To<string.uppercase>;
12
- preformatted: string.uppercase;
13
- };
14
- }
15
- export {};
@@ -1,12 +0,0 @@
1
- import { rootNode } from "@ark/schema";
2
- import { submodule } from "../utils.js";
3
- import { regexStringNode } from "./utils.js";
4
- const preformatted = regexStringNode(/^[A-Z]*$/, "only uppercase letters");
5
- export const upper = submodule({
6
- $root: rootNode({
7
- in: "string",
8
- morphs: (s) => s.toUpperCase(),
9
- declaredOut: preformatted
10
- }),
11
- preformatted
12
- });
@@ -1,15 +0,0 @@
1
- import type { Module, Submodule } from "../../module.ts";
2
- import type { Branded, constrain, To } from "../ast.ts";
3
- declare namespace string {
4
- type url = constrain<string, Branded<"url">>;
5
- }
6
- export declare const url: url.module;
7
- export declare namespace url {
8
- type module = Module<submodule>;
9
- type submodule = Submodule<$>;
10
- type $ = {
11
- $root: string.url;
12
- parse: (In: string.url) => To<URL>;
13
- };
14
- }
15
- export {};
@@ -1,37 +0,0 @@
1
- import { rootNode } from "@ark/schema";
2
- import { submodule } from "../utils.js";
3
- const isParsableUrl = (s) => {
4
- if (URL.canParse)
5
- return URL.canParse(s);
6
- // Can be removed once Node 18 is EOL
7
- try {
8
- new URL(s);
9
- return true;
10
- }
11
- catch {
12
- return false;
13
- }
14
- };
15
- const $root = rootNode({
16
- domain: "string",
17
- predicate: {
18
- meta: "a URL string",
19
- predicate: isParsableUrl
20
- }
21
- });
22
- export const url = submodule({
23
- $root,
24
- parse: rootNode({
25
- declaredIn: $root,
26
- in: "string",
27
- morphs: (s, ctx) => {
28
- try {
29
- return new URL(s);
30
- }
31
- catch {
32
- return ctx.error("a URL string");
33
- }
34
- },
35
- declaredOut: rootNode(URL)
36
- })
37
- });
@@ -1,2 +0,0 @@
1
- import { type IntersectionNode } from "@ark/schema";
2
- export declare const regexStringNode: (regex: RegExp, description: string) => IntersectionNode;
@@ -1,10 +0,0 @@
1
- import { node } from "@ark/schema";
2
- // Non-trivial expressions should have an explanation or attribution
3
- export const regexStringNode = (regex, description) => node("intersection", {
4
- domain: "string",
5
- pattern: {
6
- rule: regex.source,
7
- flags: regex.flags,
8
- meta: description
9
- }
10
- });
@@ -1,42 +0,0 @@
1
- import type { Module, Submodule } from "../../module.ts";
2
- import type { Branded, constrain } from "../ast.ts";
3
- export declare const uuid: Module<{
4
- $root: import("./string.ts").string.matching<string> | "00000000-0000-0000-0000-000000000000" | "ffffffff-ffff-ffff-ffff-ffffffffffff";
5
- v4: object;
6
- v6: object;
7
- v1: object;
8
- v2: object;
9
- v3: object;
10
- v5: object;
11
- v7: object;
12
- v8: object;
13
- }>;
14
- declare namespace string {
15
- type uuid = constrain<string, Branded<"uuid">>;
16
- namespace uuid {
17
- type v1 = constrain<string, Branded<"uuid.v1">>;
18
- type v2 = constrain<string, Branded<"uuid.v2">>;
19
- type v3 = constrain<string, Branded<"uuid.v3">>;
20
- type v4 = constrain<string, Branded<"uuid.v4">>;
21
- type v5 = constrain<string, Branded<"uuid.v5">>;
22
- type v6 = constrain<string, Branded<"uuid.v6">>;
23
- type v7 = constrain<string, Branded<"uuid.v7">>;
24
- type v8 = constrain<string, Branded<"uuid.v8">>;
25
- }
26
- }
27
- export declare namespace uuid {
28
- type module = Module<submodule>;
29
- type submodule = Submodule<$>;
30
- type $ = {
31
- $root: string.uuid;
32
- v1: string.uuid.v1;
33
- v2: string.uuid.v2;
34
- v3: string.uuid.v3;
35
- v4: string.uuid.v4;
36
- v5: string.uuid.v5;
37
- v6: string.uuid.v6;
38
- v7: string.uuid.v7;
39
- v8: string.uuid.v8;
40
- };
41
- }
42
- export {};
@@ -1,19 +0,0 @@
1
- import { submodule } from "../utils.js";
2
- import { regexStringNode } from "./utils.js";
3
- // Based on https://github.com/validatorjs/validator.js/blob/master/src/lib/isUUID.js
4
- export const uuid = submodule({
5
- // the meta tuple expression ensures the error message does not delegate
6
- // to the individual branches, which are too detailed
7
- $root: ["versioned | nil | max", "@", "a UUID"],
8
- "#nil": "'00000000-0000-0000-0000-000000000000'",
9
- "#max": "'ffffffff-ffff-ffff-ffff-ffffffffffff'",
10
- "#versioned": /[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}/i,
11
- v1: regexStringNode(/^[0-9a-f]{8}-[0-9a-f]{4}-1[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i, "a UUIDv1"),
12
- v2: regexStringNode(/^[0-9a-f]{8}-[0-9a-f]{4}-2[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i, "a UUIDv2"),
13
- v3: regexStringNode(/^[0-9a-f]{8}-[0-9a-f]{4}-3[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i, "a UUIDv3"),
14
- v4: regexStringNode(/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i, "a UUIDv4"),
15
- v5: regexStringNode(/^[0-9a-f]{8}-[0-9a-f]{4}-5[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i, "a UUIDv5"),
16
- v6: regexStringNode(/^[0-9a-f]{8}-[0-9a-f]{4}-6[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i, "a UUIDv6"),
17
- v7: regexStringNode(/^[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i, "a UUIDv7"),
18
- v8: regexStringNode(/^[0-9a-f]{8}-[0-9a-f]{4}-8[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i, "a UUIDv8")
19
- });
@@ -1 +0,0 @@
1
- export declare const submodule: import("../scope.ts").ModuleParser;
@@ -1,2 +0,0 @@
1
- import { module } from "../scope.js";
2
- export const submodule = module;
@@ -1,9 +0,0 @@
1
- import type { ErrorMessage } from "@ark/util";
2
- import type { inferAmbient } from "../../type.ts";
3
- import type { UnitLiteral } from "../string/shift/operator/default.ts";
4
- import type { inferAstOut } from "./infer.ts";
5
- import type { astToString } from "./utils.ts";
6
- import type { validateAst } from "./validate.ts";
7
- export type validateDefault<baseAst, unitLiteral extends UnitLiteral, $, args> = validateAst<baseAst, $, args> extends infer e extends ErrorMessage ? e : inferAmbient<unitLiteral> extends inferAstOut<baseAst, $, args> ? undefined : ErrorMessage<writeUnassignableDefaultValueMessage<astToString<baseAst>, unitLiteral>>;
8
- export declare const writeUnassignableDefaultValueMessage: <key extends string, message extends string>(key: key, message: message) => string;
9
- export type writeUnassignableDefaultValueMessage<baseDef extends string, defaultValue extends string> = `Default value ${defaultValue} is not assignable to ${baseDef}`;
@@ -1 +0,0 @@
1
- export const writeUnassignableDefaultValueMessage = (key, message) => `Default value at ${key} ${message}`;
@@ -1,39 +0,0 @@
1
- import type { GenericAst } from "@ark/schema";
2
- import type { Hkt, array } from "@ark/util";
3
- import type { inferIntersection } from "../../intersect.ts";
4
- import type { Date, Default, LimitLiteral, applyConstraint, distillIn, distillOut, normalizeLimit } from "../../keywords/ast.ts";
5
- import type { UnparsedScope } from "../../scope.ts";
6
- import type { inferAmbient } from "../../type.ts";
7
- import type { inferDefinition } from "../definition.ts";
8
- import type { Comparator, MinComparator } from "../string/reduce/shared.ts";
9
- export type inferAstRoot<ast, $, args> = ast extends array ? inferExpression<ast, $, args> : never;
10
- export type inferAstIn<ast, $, args> = distillIn<inferAstRoot<ast, $, args>>;
11
- export type inferAstOut<ast, $, args> = distillOut<inferAstRoot<ast, $, args>>;
12
- export type DefAst<def = unknown, alias extends string = string> = [
13
- def,
14
- "def",
15
- alias
16
- ];
17
- export type InferredAst<t = unknown, def extends string = string> = [
18
- t,
19
- "inferred",
20
- def
21
- ];
22
- export type GenericInstantiationAst<generic extends GenericAst = GenericAst, argAsts extends unknown[] = unknown[]> = [generic, "<>", argAsts];
23
- type resolveScope<g$, $> = g$ extends UnparsedScope ? $ : g$;
24
- export type inferExpression<ast, $, args> = ast extends array ? ast extends InferredAst<infer resolution> ? resolution : ast extends DefAst<infer def> ? inferDefinition<def, $, args> : ast extends GenericInstantiationAst<infer g, infer argAsts> ? g["bodyDef"] extends Hkt ? Hkt.apply<g["bodyDef"], {
25
- [i in keyof argAsts]: inferExpression<argAsts[i], $, args>;
26
- }> : inferDefinition<g["bodyDef"], resolveScope<g["$"], $>, {
27
- [i in keyof g["names"] & `${number}` as g["names"][i]]: inferExpression<argAsts[i & keyof argAsts], resolveScope<g["arg$"], $>, args>;
28
- }> : ast[1] extends "[]" ? inferExpression<ast[0], $, args>[] : ast[1] extends "|" ? inferExpression<ast[0], $, args> | inferExpression<ast[2], $, args> : ast[1] extends "&" ? inferIntersection<inferExpression<ast[0], $, args>, inferExpression<ast[2], $, args>> : ast[1] extends "=" ? inferAmbient<ast[2]> extends infer defaultValue ? (In?: inferExpression<ast[0], $, args>) => Default<defaultValue> : never : ast[1] extends Comparator ? ast[0] extends LimitLiteral ? constrainBound<inferExpression<ast[2], $, args>, ast[1], ast[0]> : constrainBound<inferExpression<ast[0], $, args>, ast[1], ast[2] & LimitLiteral> : ast[1] extends "%" ? applyConstraint<inferExpression<ast[0], $, args>, "divisor", ast[2] & number> : ast[0] extends "keyof" ? keyof inferExpression<ast[1], $, args> : never : never;
29
- export type constrainBound<constrainableIn, comparator extends Comparator, limit extends LimitLiteral> = 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", {
30
- rule: normalizeLimit<limit>;
31
- exclusive: comparator extends ">" | "<" ? true : false;
32
- }> : never;
33
- export type PrefixOperator = "keyof" | "instanceof" | "===" | "node";
34
- export type PrefixExpression<operator extends PrefixOperator = PrefixOperator, operand = unknown> = [operator, operand];
35
- export type PostfixOperator = "[]";
36
- export type PostfixExpression<operator extends PostfixOperator = PostfixOperator, operand = unknown> = readonly [operand, operator];
37
- export type InfixOperator = "|" | "&" | Comparator | "%" | ":" | "=>" | "@";
38
- export type InfixExpression<operator extends InfixOperator = InfixOperator, l = unknown, r = unknown> = [l, operator, r];
39
- export {};
@@ -1,26 +0,0 @@
1
- import type { arkKind, GenericParamAst, PrivateDeclaration, writeMissingSubmoduleAccessMessage, writeUnsatisfiedParameterConstraintMessage } from "@ark/schema";
2
- import type { anyOrNever, array, BigintLiteral, charsAfterFirst, Completion, ErrorMessage, NumberLiteral, typeToString, writeMalformedNumericLiteralMessage } from "@ark/util";
3
- import type { Generic } from "../../generic.ts";
4
- import type { Comparator } from "../string/reduce/shared.ts";
5
- import type { writeInvalidGenericArgCountMessage } from "../string/shift/operand/genericArgs.ts";
6
- import type { UnitLiteral } from "../string/shift/operator/default.ts";
7
- import type { parseString } from "../string/string.ts";
8
- import type { validateRange } from "./bounds.ts";
9
- import type { validateDefault } from "./default.ts";
10
- import type { validateDivisor } from "./divisor.ts";
11
- import type { DefAst, GenericInstantiationAst, inferAstRoot, InferredAst, InfixExpression, PostfixExpression } from "./infer.ts";
12
- import type { validateKeyof } from "./keyof.ts";
13
- import type { astToString } from "./utils.ts";
14
- export type validateAst<ast, $, args> = ast extends ErrorMessage ? ast : ast extends InferredAst ? validateInferredAst<ast[0], ast[2]> : ast extends DefAst ? ast[2] extends PrivateDeclaration ? ErrorMessage<writePrefixedPrivateReferenceMessage<ast[2]>> : undefined : 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>>> & {
15
- ast: ast;
16
- };
17
- type writeUnexpectedExpressionMessage<expression extends string> = `Unexpectedly failed to parse the expression resulting from ${expression}`;
18
- 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;
19
- export declare const writePrefixedPrivateReferenceMessage: <def extends PrivateDeclaration>(def: def) => writePrefixedPrivateReferenceMessage<def>;
20
- export type writePrefixedPrivateReferenceMessage<def extends PrivateDeclaration> = `Private type references should not include '#'. Use '${charsAfterFirst<def>}' instead.`;
21
- type validateInferredAst<inferred, def extends string> = def extends NumberLiteral ? number extends inferred ? ErrorMessage<writeMalformedNumericLiteralMessage<def, "number">> : undefined : def extends BigintLiteral ? bigint extends inferred ? ErrorMessage<writeMalformedNumericLiteralMessage<def, "bigint">> : undefined : [inferred] extends [anyOrNever] ? undefined : def extends PrivateDeclaration ? ErrorMessage<writePrefixedPrivateReferenceMessage<def>> : inferred extends Generic ? ErrorMessage<writeInvalidGenericArgCountMessage<def, inferred["names"], []>> : inferred extends {
22
- [arkKind]: "module";
23
- } ? "$root" extends keyof inferred ? undefined : ErrorMessage<writeMissingSubmoduleAccessMessage<def>> : def extends ErrorMessage ? def : undefined;
24
- export type validateString<def extends string, $, args> = validateAst<parseString<def, $, args>, $, args> extends (infer result extends ErrorMessage) ? result extends Completion<infer text> ? text : result : def;
25
- type validateInfix<ast extends InfixExpression, $, args> = validateAst<ast[0], $, args> extends infer e extends ErrorMessage ? e : validateAst<ast[2], $, args> extends infer e extends ErrorMessage ? e : undefined;
26
- export {};
@@ -1 +0,0 @@
1
- export const writePrefixedPrivateReferenceMessage = (def) => `Private type references should not include '#'. Use '${def.slice(1)}' instead.`;
@@ -1,9 +0,0 @@
1
- import { type WhiteSpaceToken } from "@ark/util";
2
- import type { DynamicState } from "../../reduce/dynamic.ts";
3
- import type { StaticState, state } from "../../reduce/static.ts";
4
- import type { BaseCompletions } from "../../string.ts";
5
- import type { Scanner } from "../scanner.ts";
6
- import { parseEnclosed, type EnclosingQuote, type EnclosingStartToken } from "./enclosed.ts";
7
- import { parseUnenclosed } from "./unenclosed.ts";
8
- export declare const parseOperand: (s: DynamicState) => void;
9
- export type parseOperand<s extends StaticState, $, args> = s["unscanned"] extends Scanner.shift<infer lookahead, infer unscanned> ? lookahead extends "(" ? state.reduceGroupOpen<s, unscanned> : lookahead extends EnclosingStartToken ? parseEnclosed<s, lookahead, unscanned> : lookahead extends WhiteSpaceToken ? parseOperand<state.scanTo<s, unscanned>, $, args> : lookahead extends "d" ? unscanned extends (Scanner.shift<infer enclosing extends EnclosingQuote, infer nextUnscanned>) ? parseEnclosed<s, `d${enclosing}`, nextUnscanned> : parseUnenclosed<s, $, args> : parseUnenclosed<s, $, args> : state.completion<`${s["scanned"]}${BaseCompletions<$, args>}`>;
@@ -1,13 +0,0 @@
1
- import { type WhiteSpaceToken } from "@ark/util";
2
- import type { DynamicStateWithRoot } from "../../reduce/dynamic.ts";
3
- import type { StaticState, state } from "../../reduce/static.ts";
4
- import { Scanner } from "../scanner.ts";
5
- import { parseBound, type ComparatorStartChar } from "./bounds.ts";
6
- import { parseDivisor } from "./divisor.ts";
7
- export declare const parseOperator: (s: DynamicStateWithRoot) => void;
8
- export type parseOperator<s extends StaticState, $, args> = s["unscanned"] extends Scanner.shift<infer lookahead, infer unscanned> ? lookahead extends "[" ? unscanned extends Scanner.shift<"]", infer nextUnscanned> ? state.setRoot<s, [s["root"], "[]"], nextUnscanned> : state.error<incompleteArrayTokenMessage> : lookahead extends "|" | "&" ? state.reduceBranch<s, lookahead, unscanned> : lookahead extends ")" ? state.finalizeGroup<s, unscanned> : Scanner.lookaheadIsFinalizing<lookahead, unscanned> extends true ? state.finalize<state.scanTo<s, unscanned>, lookahead & Scanner.FinalizingLookahead> : lookahead extends ComparatorStartChar ? parseBound<s, lookahead, unscanned, $, args> : lookahead extends "%" ? parseDivisor<s, unscanned> : lookahead extends WhiteSpaceToken ? parseOperator<state.scanTo<s, unscanned>, $, args> : state.error<writeUnexpectedCharacterMessage<lookahead>> : state.finalize<s, "">;
9
- export declare const writeUnexpectedCharacterMessage: <char extends string, shouldBe extends string>(char: char, shouldBe?: shouldBe) => writeUnexpectedCharacterMessage<char, shouldBe>;
10
- export type writeUnexpectedCharacterMessage<char extends string, shouldBe extends string = ""> = `'${char}' is not allowed here${shouldBe extends "" ? "" : ` (should be ${shouldBe})`}`;
11
- export declare const incompleteArrayTokenMessage = "Missing expected ']'";
12
- type incompleteArrayTokenMessage = typeof incompleteArrayTokenMessage;
13
- export {};
@@ -1,69 +0,0 @@
1
- import { type Dict, type EscapeToken, type WhiteSpaceToken } from "@ark/util";
2
- import type { Comparator } from "../reduce/shared.ts";
3
- export declare class Scanner<lookahead extends string = string> {
4
- private chars;
5
- private i;
6
- constructor(def: string);
7
- /** Get lookahead and advance scanner by one */
8
- shift(): lookahead;
9
- get lookahead(): lookahead;
10
- get nextLookahead(): string;
11
- get length(): number;
12
- shiftUntil(condition: Scanner.UntilCondition): string;
13
- shiftUntilNextTerminator(): string;
14
- shiftUntilNonWhitespace(): string;
15
- jumpToIndex(i: number): void;
16
- jumpForward(count: number): void;
17
- get location(): number;
18
- get unscanned(): string;
19
- get scanned(): string;
20
- sliceChars(start: number, end?: number): string;
21
- lookaheadIs<char extends lookahead>(char: char): this is Scanner<char>;
22
- lookaheadIsIn<tokens extends Dict>(tokens: tokens): this is Scanner<Extract<keyof tokens, string>>;
23
- static terminatingChars: {
24
- readonly " ": true;
25
- readonly "\n": true;
26
- readonly "\t": true;
27
- readonly "<": true;
28
- readonly ">": true;
29
- readonly "=": true;
30
- readonly "|": true;
31
- readonly "&": true;
32
- readonly ")": true;
33
- readonly "[": true;
34
- readonly "%": true;
35
- readonly ",": true;
36
- readonly ":": true;
37
- };
38
- static finalizingLookaheads: {
39
- readonly ">": true;
40
- readonly ",": true;
41
- readonly "": true;
42
- readonly "=": true;
43
- };
44
- static lookaheadIsTerminator: Scanner.UntilCondition;
45
- static lookaheadIsNotWhitespace: Scanner.UntilCondition;
46
- static lookaheadIsFinalizing: (lookahead: string, unscanned: string) => lookahead is ">" | "," | "=";
47
- }
48
- export declare namespace Scanner {
49
- 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 "=" ? unscanned extends `=${string}` ? false : true : lookahead extends "," ? true : false;
50
- type UntilCondition = (scanner: Scanner, shifted: string) => boolean;
51
- type OnInputEndFn = (scanner: Scanner, shifted: string) => string;
52
- type ShiftUntilOptions = {
53
- onInputEnd?: OnInputEndFn;
54
- };
55
- type TerminatingChar = keyof typeof Scanner.terminatingChars;
56
- type FinalizingLookahead = keyof typeof Scanner.finalizingLookaheads;
57
- type InfixToken = Comparator | "|" | "&" | "%" | ":" | "=>";
58
- type PostfixToken = "[]";
59
- type OperatorToken = InfixToken | PostfixToken;
60
- type shift<lookahead extends string, unscanned extends string> = `${lookahead}${unscanned}`;
61
- 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, ""];
62
- 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, ""];
63
- type shiftUntilNextTerminator<unscanned extends string> = shiftUntil<unscanned, TerminatingChar>;
64
- type skipWhitespace<unscanned extends string> = shiftUntilNot<unscanned, WhiteSpaceToken>[1];
65
- type shiftResult<scanned extends string, unscanned extends string> = [
66
- scanned,
67
- unscanned
68
- ];
69
- }
@@ -1,100 +0,0 @@
1
- import { escapeToken, isKeyOf, whiteSpaceTokens } from "@ark/util";
2
- export class Scanner {
3
- chars;
4
- i;
5
- constructor(def) {
6
- this.chars = [...def];
7
- this.i = 0;
8
- }
9
- /** Get lookahead and advance scanner by one */
10
- shift() {
11
- return (this.chars[this.i++] ?? "");
12
- }
13
- get lookahead() {
14
- return (this.chars[this.i] ?? "");
15
- }
16
- get nextLookahead() {
17
- return this.chars[this.i + 1] ?? "";
18
- }
19
- get length() {
20
- return this.chars.length;
21
- }
22
- shiftUntil(condition) {
23
- let shifted = "";
24
- while (this.lookahead) {
25
- if (condition(this, shifted)) {
26
- if (shifted[shifted.length - 1] === escapeToken)
27
- shifted = shifted.slice(0, -1);
28
- else
29
- break;
30
- }
31
- shifted += this.shift();
32
- }
33
- return shifted;
34
- }
35
- shiftUntilNextTerminator() {
36
- this.shiftUntilNonWhitespace();
37
- return this.shiftUntil(Scanner.lookaheadIsTerminator);
38
- }
39
- shiftUntilNonWhitespace() {
40
- return this.shiftUntil(Scanner.lookaheadIsNotWhitespace);
41
- }
42
- jumpToIndex(i) {
43
- this.i = i < 0 ? this.length + i : i;
44
- }
45
- jumpForward(count) {
46
- this.i += count;
47
- }
48
- get location() {
49
- return this.i;
50
- }
51
- get unscanned() {
52
- return this.chars.slice(this.i, this.length).join("");
53
- }
54
- get scanned() {
55
- return this.chars.slice(0, this.i).join("");
56
- }
57
- sliceChars(start, end) {
58
- return this.chars.slice(start, end).join("");
59
- }
60
- lookaheadIs(char) {
61
- return this.lookahead === char;
62
- }
63
- lookaheadIsIn(tokens) {
64
- return this.lookahead in tokens;
65
- }
66
- static terminatingChars = {
67
- "<": true,
68
- ">": true,
69
- "=": true,
70
- "|": true,
71
- "&": true,
72
- ")": true,
73
- "[": true,
74
- "%": true,
75
- ",": true,
76
- ":": true,
77
- ...whiteSpaceTokens
78
- };
79
- static finalizingLookaheads = {
80
- ">": true,
81
- ",": true,
82
- "": true,
83
- "=": true
84
- };
85
- static lookaheadIsTerminator = (scanner) => scanner.lookahead in this.terminatingChars;
86
- static lookaheadIsNotWhitespace = (scanner) => !(scanner.lookahead in whiteSpaceTokens);
87
- static 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
- // "=" is a finalizer on its own (representing a default value),
96
- // but not with a second "=" (an equality comparator)
97
- : lookahead === "=" ? unscanned[0] !== "="
98
- // ","" is unambiguously a finalizer
99
- : lookahead === ",";
100
- }
@@ -1,132 +0,0 @@
1
- import { type BaseRoot, type MetaSchema, type Morph, type Predicate } from "@ark/schema";
2
- import { type array, type BuiltinObjectKind, type conform, type Constructor, type Domain, type ErrorMessage, type show } from "@ark/util";
3
- import type { inferIntersection } from "../intersect.ts";
4
- import type { distillConstrainableIn, distillOut, inferMorphOut, inferPredicate, Out } from "../keywords/ast.ts";
5
- import type { ParseContext } from "../scope.ts";
6
- import type { inferDefinition, validateDefinition } from "./definition.ts";
7
- import type { InfixOperator, PostfixExpression } from "./semantic/infer.ts";
8
- import { writeMissingRightOperandMessage } from "./string/shift/operand/unenclosed.ts";
9
- import type { BaseCompletions } from "./string/string.ts";
10
- export declare const parseTuple: (def: array, ctx: ParseContext) => BaseRoot;
11
- export declare const parseTupleLiteral: (def: array, ctx: ParseContext) => BaseRoot;
12
- type InfixExpression = readonly [unknown, InfixOperator, ...unknown[]];
13
- 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 [
14
- def[0] extends "" ? BaseCompletions<$, args, IndexZeroOperator | "..."> : def[0],
15
- def[1] extends "" ? BaseCompletions<$, args, IndexOneOperator | "..." | "?"> : def[1]
16
- ] : validateTupleLiteral<def, $, args>;
17
- export type validateTupleLiteral<def extends array, $, args> = parseSequence<def, $, args> extends infer s extends SequenceParseState ? Readonly<s["validated"]> : never;
18
- type inferTupleLiteral<def extends array, $, args> = parseSequence<def, $, args> extends infer s extends SequenceParseState ? s["inferred"] : never;
19
- type SequenceParseState = {
20
- unscanned: array;
21
- inferred: array;
22
- validated: array;
23
- };
24
- type parseSequence<def extends array, $, args> = parseNextElement<{
25
- unscanned: def;
26
- inferred: [];
27
- validated: [];
28
- }, $, args>;
29
- type PreparsedElement = {
30
- head: unknown;
31
- tail: array;
32
- optional: boolean;
33
- spread: boolean;
34
- };
35
- declare namespace PreparsedElement {
36
- type from<result extends PreparsedElement> = result;
37
- }
38
- type preparseNextElement<s extends SequenceParseState> = s["unscanned"] extends readonly ["...", infer head, ...infer tail] ? tail extends readonly ["?", ...infer postOptionalTail] ? PreparsedElement.from<{
39
- head: head;
40
- tail: postOptionalTail;
41
- optional: true;
42
- spread: true;
43
- }> : PreparsedElement.from<{
44
- head: head;
45
- tail: tail;
46
- optional: false;
47
- spread: true;
48
- }> : s["unscanned"] extends readonly [infer head, "?", ...infer tail] ? PreparsedElement.from<{
49
- head: head;
50
- tail: tail;
51
- optional: true;
52
- spread: false;
53
- }> : s["unscanned"] extends readonly [infer head, ...infer tail] ? PreparsedElement.from<{
54
- head: head;
55
- tail: tail;
56
- optional: false;
57
- spread: false;
58
- }> : null;
59
- type parseNextElement<s extends SequenceParseState, $, args> = preparseNextElement<s> extends infer next extends PreparsedElement ? parseNextElement<{
60
- unscanned: next["tail"];
61
- inferred: next["spread"] extends true ? [
62
- ...s["inferred"],
63
- ...conform<inferDefinition<next["head"], $, args>, array>
64
- ] : next["optional"] extends true ? [
65
- ...s["inferred"],
66
- inferDefinition<next["head"], $, args>?
67
- ] : [...s["inferred"], inferDefinition<next["head"], $, args>];
68
- validated: [
69
- ...s["validated"],
70
- ...(next["spread"] extends true ? [
71
- inferDefinition<next["head"], $, args> extends (infer spreadOperand extends array) ? [
72
- number,
73
- number
74
- ] extends ([
75
- s["inferred"]["length"],
76
- spreadOperand["length"]
77
- ]) ? ErrorMessage<multipleVariadicMessage> : "..." : ErrorMessage<writeNonArraySpreadMessage<next["head"]>>
78
- ] : []),
79
- [
80
- next["optional"] | next["spread"],
81
- "?"
82
- ] extends ([
83
- false,
84
- s["validated"][number]
85
- ]) ? ErrorMessage<requiredPostOptionalMessage> : validateDefinition<next["head"], $, args>,
86
- ...(next["optional"] extends true ? [
87
- next["spread"] extends true ? ErrorMessage<spreadOptionalMessage> : number extends s["inferred"]["length"] ? ErrorMessage<optionalPostVariadicMessage> : "?"
88
- ] : [])
89
- ];
90
- }, $, args> : s;
91
- export declare const writeNonArraySpreadMessage: <operand extends string>(operand: operand) => writeNonArraySpreadMessage<operand>;
92
- type writeNonArraySpreadMessage<operand> = `Spread element must be an array${operand extends string ? ` (was ${operand})` : ""}`;
93
- export declare const multipleVariadicMesage = "A tuple may have at most one variadic element";
94
- type multipleVariadicMessage = typeof multipleVariadicMesage;
95
- export declare const requiredPostOptionalMessage = "A required element may not follow an optional element";
96
- type requiredPostOptionalMessage = typeof requiredPostOptionalMessage;
97
- export declare const optionalPostVariadicMessage = "An optional element may not follow a variadic element";
98
- type optionalPostVariadicMessage = typeof optionalPostVariadicMessage;
99
- export declare const spreadOptionalMessage = "A spread element cannot be optional";
100
- type spreadOptionalMessage = typeof optionalPostVariadicMessage;
101
- export type inferTuple<def extends array, $, args> = def extends TupleExpression ? inferTupleExpression<def, $, args> : inferTupleLiteral<def, $, args>;
102
- 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 ":" ? inferPredicate<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;
103
- 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;
104
- export type validatePostfixExpression<def extends PostfixExpression, $, args> = conform<def, readonly [validateDefinition<def[0], $, args>, "[]"]>;
105
- export type validateInfixExpression<def extends InfixExpression, $, args> = def["length"] extends 2 ? readonly [def[0], writeMissingRightOperandMessage<def[1]>] : readonly [
106
- validateDefinition<def[0], $, args>,
107
- def[1],
108
- def[1] extends "|" ? validateDefinition<def[2], $, args> : def[1] extends "&" ? validateDefinition<def[2], $, args> : def[1] extends ":" ? Predicate<distillOut<inferDefinition<def[0], $, args>>> : def[1] extends "=>" ? Morph<distillOut<inferDefinition<def[0], $, args>>, unknown> : def[1] extends "@" ? MetaSchema : validateDefinition<def[2], $, args>
109
- ];
110
- export type UnparsedTupleExpressionInput = {
111
- instanceof: Constructor;
112
- "===": unknown;
113
- };
114
- export type UnparsedTupleOperator = show<keyof UnparsedTupleExpressionInput>;
115
- export declare const parseKeyOfTuple: PrefixParser<"keyof">;
116
- export type inferKeyOfExpression<operandDef, $, args> = show<keyof inferDefinition<operandDef, $, args>>;
117
- export type PostfixParser<token extends IndexOneOperator> = (def: IndexOneExpression<token>, ctx: ParseContext) => BaseRoot;
118
- export type PrefixParser<token extends IndexZeroOperator> = (def: IndexZeroExpression<token>, ctx: ParseContext) => BaseRoot;
119
- export type TupleExpression = IndexZeroExpression | IndexOneExpression;
120
- export type TupleExpressionOperator = IndexZeroOperator | IndexOneOperator;
121
- export type IndexOneOperator = TuplePostfixOperator | TupleInfixOperator;
122
- export type TuplePostfixOperator = "[]";
123
- export type TupleInfixOperator = "&" | "|" | "=>" | ":" | "@";
124
- export type IndexOneExpression<token extends IndexOneOperator = IndexOneOperator> = readonly [unknown, token, ...unknown[]];
125
- export declare const parseMorphTuple: PostfixParser<"=>">;
126
- export declare const writeMalformedFunctionalExpressionMessage: (operator: ":" | "=>", value: unknown) => string;
127
- export type parseMorph<inDef, morph, $, args> = morph extends Morph ? inferMorphOut<morph> extends infer out ? (In: distillConstrainableIn<inferDefinition<inDef, $, args>>) => Out<out> : never : never;
128
- export declare const parseNarrowTuple: PostfixParser<":">;
129
- export type IndexZeroOperator = "keyof" | "instanceof" | "===";
130
- export type IndexZeroExpression<token extends IndexZeroOperator = IndexZeroOperator> = readonly [token, ...unknown[]];
131
- export declare const writeInvalidConstructorMessage: <actual extends Domain | BuiltinObjectKind>(actual: actual) => string;
132
- export {};