arktype 1.1.0-dev-2 → 2.0.0-beta.0

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 (225) hide show
  1. package/LICENSE +7 -0
  2. package/out/ark.d.ts +24 -0
  3. package/out/ark.js +8 -0
  4. package/out/config.d.ts +1 -0
  5. package/out/config.js +2 -0
  6. package/out/generic.d.ts +54 -0
  7. package/out/generic.js +39 -0
  8. package/out/index.d.ts +6 -0
  9. package/out/index.js +5 -0
  10. package/out/match.d.ts +71 -0
  11. package/out/match.js +50 -0
  12. package/out/module.d.ts +11 -0
  13. package/out/module.js +2 -0
  14. package/{dist → out}/parser/definition.d.ts +16 -16
  15. package/{dist → out}/parser/definition.js +12 -12
  16. package/out/parser/objectLiteral.d.ts +79 -0
  17. package/out/parser/objectLiteral.js +100 -0
  18. package/out/parser/semantic/bounds.d.ts +15 -0
  19. package/{dist → out}/parser/semantic/bounds.js +0 -1
  20. package/out/parser/semantic/default.d.ts +8 -0
  21. package/out/parser/semantic/default.js +1 -0
  22. package/out/parser/semantic/divisor.d.ts +7 -0
  23. package/out/parser/semantic/divisor.js +1 -0
  24. package/out/parser/semantic/infer.d.ts +25 -0
  25. package/out/parser/semantic/infer.js +1 -0
  26. package/out/parser/semantic/utils.d.ts +4 -0
  27. package/out/parser/semantic/utils.js +1 -0
  28. package/out/parser/semantic/validate.d.ts +30 -0
  29. package/out/parser/semantic/validate.js +2 -0
  30. package/out/parser/string/reduce/dynamic.d.ts +43 -0
  31. package/{dist → out}/parser/string/reduce/dynamic.js +50 -33
  32. package/out/parser/string/reduce/shared.d.ts +42 -0
  33. package/{dist → out}/parser/string/reduce/shared.js +22 -2
  34. package/{dist → out}/parser/string/reduce/static.d.ts +29 -27
  35. package/out/parser/string/reduce/static.js +1 -0
  36. package/out/parser/string/shift/operand/date.d.ts +9 -0
  37. package/{dist → out}/parser/string/shift/operand/date.js +5 -8
  38. package/{dist → out}/parser/string/shift/operand/enclosed.d.ts +5 -16
  39. package/{dist → out}/parser/string/shift/operand/enclosed.js +15 -15
  40. package/out/parser/string/shift/operand/genericArgs.d.ts +28 -0
  41. package/out/parser/string/shift/operand/genericArgs.js +16 -0
  42. package/out/parser/string/shift/operand/operand.d.ts +9 -0
  43. package/out/parser/string/shift/operand/operand.js +12 -0
  44. package/out/parser/string/shift/operand/unenclosed.d.ts +30 -0
  45. package/out/parser/string/shift/operand/unenclosed.js +53 -0
  46. package/out/parser/string/shift/operator/bounds.d.ts +27 -0
  47. package/out/parser/string/shift/operator/bounds.js +94 -0
  48. package/out/parser/string/shift/operator/default.d.ts +24 -0
  49. package/out/parser/string/shift/operator/default.js +23 -0
  50. package/{dist → out}/parser/string/shift/operator/divisor.d.ts +2 -4
  51. package/{dist → out}/parser/string/shift/operator/divisor.js +2 -4
  52. package/{dist → out}/parser/string/shift/operator/operator.d.ts +4 -4
  53. package/out/parser/string/shift/operator/operator.js +22 -0
  54. package/{dist → out}/parser/string/shift/scanner.d.ts +13 -17
  55. package/{dist → out}/parser/string/shift/scanner.js +27 -24
  56. package/out/parser/string/string.d.ts +28 -0
  57. package/out/parser/string/string.js +24 -0
  58. package/out/parser/tuple.d.ts +130 -0
  59. package/out/parser/tuple.js +157 -0
  60. package/out/scope.d.ts +84 -0
  61. package/out/scope.js +131 -0
  62. package/out/type.d.ts +79 -0
  63. package/out/type.js +37 -0
  64. package/package.json +37 -41
  65. package/dist/main.d.ts +0 -11
  66. package/dist/main.d.ts.map +0 -1
  67. package/dist/main.js +0 -8
  68. package/dist/main.js.map +0 -1
  69. package/dist/match.d.ts +0 -46
  70. package/dist/match.d.ts.map +0 -1
  71. package/dist/match.js +0 -23
  72. package/dist/match.js.map +0 -1
  73. package/dist/parser/definition.d.ts.map +0 -1
  74. package/dist/parser/definition.js.map +0 -1
  75. package/dist/parser/generic.d.ts +0 -44
  76. package/dist/parser/generic.d.ts.map +0 -1
  77. package/dist/parser/generic.js +0 -46
  78. package/dist/parser/generic.js.map +0 -1
  79. package/dist/parser/objectLiteral.d.ts +0 -24
  80. package/dist/parser/objectLiteral.d.ts.map +0 -1
  81. package/dist/parser/objectLiteral.js +0 -38
  82. package/dist/parser/objectLiteral.js.map +0 -1
  83. package/dist/parser/semantic/bounds.d.ts +0 -13
  84. package/dist/parser/semantic/bounds.d.ts.map +0 -1
  85. package/dist/parser/semantic/bounds.js.map +0 -1
  86. package/dist/parser/semantic/divisor.d.ts +0 -9
  87. package/dist/parser/semantic/divisor.d.ts.map +0 -1
  88. package/dist/parser/semantic/divisor.js +0 -2
  89. package/dist/parser/semantic/divisor.js.map +0 -1
  90. package/dist/parser/semantic/intersections.d.ts +0 -15
  91. package/dist/parser/semantic/intersections.d.ts.map +0 -1
  92. package/dist/parser/semantic/intersections.js +0 -2
  93. package/dist/parser/semantic/intersections.js.map +0 -1
  94. package/dist/parser/semantic/semantic.d.ts +0 -22
  95. package/dist/parser/semantic/semantic.d.ts.map +0 -1
  96. package/dist/parser/semantic/semantic.js +0 -2
  97. package/dist/parser/semantic/semantic.js.map +0 -1
  98. package/dist/parser/semantic/utils.d.ts +0 -8
  99. package/dist/parser/semantic/utils.d.ts.map +0 -1
  100. package/dist/parser/semantic/utils.js +0 -2
  101. package/dist/parser/semantic/utils.js.map +0 -1
  102. package/dist/parser/semantic/validate.d.ts +0 -24
  103. package/dist/parser/semantic/validate.d.ts.map +0 -1
  104. package/dist/parser/semantic/validate.js +0 -2
  105. package/dist/parser/semantic/validate.js.map +0 -1
  106. package/dist/parser/shared.d.ts +0 -48
  107. package/dist/parser/shared.d.ts.map +0 -1
  108. package/dist/parser/shared.js +0 -41
  109. package/dist/parser/shared.js.map +0 -1
  110. package/dist/parser/string/reduce/dynamic.d.ts +0 -40
  111. package/dist/parser/string/reduce/dynamic.d.ts.map +0 -1
  112. package/dist/parser/string/reduce/dynamic.js.map +0 -1
  113. package/dist/parser/string/reduce/shared.d.ts +0 -29
  114. package/dist/parser/string/reduce/shared.d.ts.map +0 -1
  115. package/dist/parser/string/reduce/shared.js.map +0 -1
  116. package/dist/parser/string/reduce/static.d.ts.map +0 -1
  117. package/dist/parser/string/reduce/static.js +0 -2
  118. package/dist/parser/string/reduce/static.js.map +0 -1
  119. package/dist/parser/string/shift/operand/date.d.ts +0 -11
  120. package/dist/parser/string/shift/operand/date.d.ts.map +0 -1
  121. package/dist/parser/string/shift/operand/date.js.map +0 -1
  122. package/dist/parser/string/shift/operand/enclosed.d.ts.map +0 -1
  123. package/dist/parser/string/shift/operand/enclosed.js.map +0 -1
  124. package/dist/parser/string/shift/operand/operand.d.ts +0 -9
  125. package/dist/parser/string/shift/operand/operand.d.ts.map +0 -1
  126. package/dist/parser/string/shift/operand/operand.js +0 -17
  127. package/dist/parser/string/shift/operand/operand.js.map +0 -1
  128. package/dist/parser/string/shift/operand/unenclosed.d.ts +0 -36
  129. package/dist/parser/string/shift/operand/unenclosed.d.ts.map +0 -1
  130. package/dist/parser/string/shift/operand/unenclosed.js +0 -68
  131. package/dist/parser/string/shift/operand/unenclosed.js.map +0 -1
  132. package/dist/parser/string/shift/operator/bounds.d.ts +0 -55
  133. package/dist/parser/string/shift/operator/bounds.d.ts.map +0 -1
  134. package/dist/parser/string/shift/operator/bounds.js +0 -95
  135. package/dist/parser/string/shift/operator/bounds.js.map +0 -1
  136. package/dist/parser/string/shift/operator/divisor.d.ts.map +0 -1
  137. package/dist/parser/string/shift/operator/divisor.js.map +0 -1
  138. package/dist/parser/string/shift/operator/operator.d.ts.map +0 -1
  139. package/dist/parser/string/shift/operator/operator.js +0 -29
  140. package/dist/parser/string/shift/operator/operator.js.map +0 -1
  141. package/dist/parser/string/shift/scanner.d.ts.map +0 -1
  142. package/dist/parser/string/shift/scanner.js.map +0 -1
  143. package/dist/parser/string/string.d.ts +0 -26
  144. package/dist/parser/string/string.d.ts.map +0 -1
  145. package/dist/parser/string/string.js +0 -31
  146. package/dist/parser/string/string.js.map +0 -1
  147. package/dist/parser/tuple.d.ts +0 -73
  148. package/dist/parser/tuple.d.ts.map +0 -1
  149. package/dist/parser/tuple.js +0 -134
  150. package/dist/parser/tuple.js.map +0 -1
  151. package/dist/scope.d.ts +0 -159
  152. package/dist/scope.d.ts.map +0 -1
  153. package/dist/scope.js +0 -248
  154. package/dist/scope.js.map +0 -1
  155. package/dist/scopes/ark.d.ts +0 -38
  156. package/dist/scopes/ark.d.ts.map +0 -1
  157. package/dist/scopes/ark.js +0 -24
  158. package/dist/scopes/ark.js.map +0 -1
  159. package/dist/scopes/jsObjects.d.ts +0 -19
  160. package/dist/scopes/jsObjects.d.ts.map +0 -1
  161. package/dist/scopes/jsObjects.js +0 -15
  162. package/dist/scopes/jsObjects.js.map +0 -1
  163. package/dist/scopes/parsing.d.ts +0 -18
  164. package/dist/scopes/parsing.d.ts.map +0 -1
  165. package/dist/scopes/parsing.js +0 -61
  166. package/dist/scopes/parsing.js.map +0 -1
  167. package/dist/scopes/tsGenerics.d.ts +0 -17
  168. package/dist/scopes/tsGenerics.d.ts.map +0 -1
  169. package/dist/scopes/tsGenerics.js +0 -13
  170. package/dist/scopes/tsGenerics.js.map +0 -1
  171. package/dist/scopes/tsKeywords.d.ts +0 -24
  172. package/dist/scopes/tsKeywords.d.ts.map +0 -1
  173. package/dist/scopes/tsKeywords.js +0 -20
  174. package/dist/scopes/tsKeywords.js.map +0 -1
  175. package/dist/scopes/utils/creditCard.d.ts +0 -3
  176. package/dist/scopes/utils/creditCard.d.ts.map +0 -1
  177. package/dist/scopes/utils/creditCard.js +0 -36
  178. package/dist/scopes/utils/creditCard.js.map +0 -1
  179. package/dist/scopes/utils/date.d.ts +0 -24
  180. package/dist/scopes/utils/date.d.ts.map +0 -1
  181. package/dist/scopes/utils/date.js +0 -53
  182. package/dist/scopes/utils/date.js.map +0 -1
  183. package/dist/scopes/validation.d.ts +0 -20
  184. package/dist/scopes/validation.d.ts.map +0 -1
  185. package/dist/scopes/validation.js +0 -57
  186. package/dist/scopes/validation.js.map +0 -1
  187. package/dist/type.d.ts +0 -101
  188. package/dist/type.d.ts.map +0 -1
  189. package/dist/type.js +0 -138
  190. package/dist/type.js.map +0 -1
  191. package/main.ts +0 -20
  192. package/match.ts +0 -137
  193. package/parser/definition.ts +0 -156
  194. package/parser/generic.ts +0 -208
  195. package/parser/objectLiteral.ts +0 -120
  196. package/parser/semantic/bounds.ts +0 -63
  197. package/parser/semantic/divisor.ts +0 -13
  198. package/parser/semantic/intersections.ts +0 -47
  199. package/parser/semantic/semantic.ts +0 -107
  200. package/parser/semantic/utils.ts +0 -26
  201. package/parser/semantic/validate.ts +0 -105
  202. package/parser/shared.ts +0 -141
  203. package/parser/string/reduce/dynamic.ts +0 -181
  204. package/parser/string/reduce/shared.ts +0 -73
  205. package/parser/string/reduce/static.ts +0 -300
  206. package/parser/string/shift/operand/date.ts +0 -57
  207. package/parser/string/shift/operand/enclosed.ts +0 -119
  208. package/parser/string/shift/operand/operand.ts +0 -48
  209. package/parser/string/shift/operand/unenclosed.ts +0 -282
  210. package/parser/string/shift/operator/bounds.ts +0 -229
  211. package/parser/string/shift/operator/divisor.ts +0 -36
  212. package/parser/string/shift/operator/operator.ts +0 -82
  213. package/parser/string/shift/scanner.ts +0 -209
  214. package/parser/string/string.ts +0 -93
  215. package/parser/tuple.ts +0 -475
  216. package/scope.ts +0 -573
  217. package/scopes/ark.ts +0 -64
  218. package/scopes/jsObjects.ts +0 -29
  219. package/scopes/parsing.ts +0 -81
  220. package/scopes/tsGenerics.ts +0 -28
  221. package/scopes/tsKeywords.ts +0 -39
  222. package/scopes/utils/creditCard.ts +0 -37
  223. package/scopes/utils/date.ts +0 -108
  224. package/scopes/validation.ts +0 -81
  225. package/type.ts +0 -403
@@ -1,209 +0,0 @@
1
- import { isKeyOf, type Dict } from "@arktype/util"
2
- import type { Comparator } from "./operator/bounds.js"
3
-
4
- export class Scanner<Lookahead extends string = string> {
5
- private chars: string[]
6
- private i: number
7
-
8
- constructor(def: string) {
9
- this.chars = [...def]
10
- this.i = 0
11
- }
12
-
13
- /** Get lookahead and advance scanner by one */
14
- shift() {
15
- return (this.chars[this.i++] ?? "") as Lookahead
16
- }
17
-
18
- get lookahead() {
19
- return (this.chars[this.i] ?? "") as Lookahead
20
- }
21
-
22
- get length() {
23
- return this.chars.length
24
- }
25
-
26
- shiftUntil(condition: Scanner.UntilCondition): string {
27
- let shifted = ""
28
- while (this.lookahead) {
29
- if (condition(this, shifted)) {
30
- if (shifted[shifted.length - 1] === Scanner.escapeToken) {
31
- shifted = shifted.slice(0, -1)
32
- } else {
33
- break
34
- }
35
- }
36
- shifted += this.shift()
37
- }
38
- return shifted
39
- }
40
-
41
- shiftUntilNextTerminator() {
42
- this.shiftUntilNonWhitespace()
43
- return this.shiftUntil(Scanner.lookaheadIsTerminator)
44
- }
45
-
46
- shiftUntilNonWhitespace() {
47
- return this.shiftUntil(Scanner.lookaheadIsNotWhitespace)
48
- }
49
-
50
- jumpToIndex(i: number) {
51
- this.i = i < 0 ? this.length + i : i
52
- }
53
-
54
- get location() {
55
- return this.i
56
- }
57
-
58
- get unscanned() {
59
- return this.chars.slice(this.i, this.length).join("")
60
- }
61
-
62
- get scanned() {
63
- return this.chars.slice(0, this.i).join("")
64
- }
65
-
66
- sliceChars(start: number, end?: number) {
67
- return this.chars.slice(start, end).join("")
68
- }
69
-
70
- lookaheadIs<Char extends Lookahead>(char: Char): this is Scanner<Char> {
71
- return this.lookahead === char
72
- }
73
-
74
- lookaheadIsIn<Tokens extends Dict>(
75
- tokens: Tokens
76
- ): this is Scanner<Extract<keyof Tokens, string>> {
77
- return this.lookahead in tokens
78
- }
79
- }
80
-
81
- export namespace Scanner {
82
- export type UntilCondition = (scanner: Scanner, shifted: string) => boolean
83
-
84
- export type OnInputEndFn = (scanner: Scanner, shifted: string) => string
85
-
86
- export type ShiftUntilOptions = {
87
- onInputEnd?: OnInputEndFn
88
- }
89
-
90
- export const lookaheadIsTerminator: UntilCondition = (scanner: Scanner) =>
91
- scanner.lookahead in terminatingChars
92
-
93
- export const lookaheadIsNotWhitespace: UntilCondition = (scanner: Scanner) =>
94
- !(scanner.lookahead in whiteSpaceTokens)
95
-
96
- export const terminatingChars = {
97
- "<": true,
98
- ">": true,
99
- "=": true,
100
- "|": true,
101
- "&": true,
102
- ")": true,
103
- "[": true,
104
- "%": true,
105
- " ": true,
106
- ",": true
107
- } as const
108
-
109
- export type TerminatingChar = keyof typeof terminatingChars
110
-
111
- export const finalizingLookaheads = {
112
- ">": true,
113
- ",": true,
114
- "": true
115
- } as const
116
-
117
- export type FinalizingLookahead = keyof typeof finalizingLookaheads
118
-
119
- export type InfixToken = Comparator | "|" | "&" | "%" | ":" | "=>"
120
-
121
- export type PostfixToken = "[]"
122
-
123
- export type OperatorToken = InfixToken | PostfixToken
124
-
125
- export const escapeToken = "\\"
126
-
127
- export type EscapeToken = typeof escapeToken
128
-
129
- export const whiteSpaceTokens = {
130
- " ": true,
131
- "\n": true
132
- } as const
133
-
134
- export type WhiteSpaceToken = keyof typeof whiteSpaceTokens
135
-
136
- export const lookaheadIsFinalizing = (
137
- lookahead: string,
138
- unscanned: string
139
- ): lookahead is ">" | "," =>
140
- lookahead === ">"
141
- ? unscanned[0] === "="
142
- ? // >== would only occur in an expression like Array<number>==5
143
- // otherwise, >= would only occur as part of a bound like number>=5
144
- unscanned[1] === "="
145
- : // if > is the end of a generic instantiation, the next token will be an operator or the end of the string
146
- unscanned.trimStart() === "" ||
147
- isKeyOf(unscanned.trimStart()[0], Scanner.terminatingChars)
148
- : // if the lookahead is a finalizing token but not >, it's unambiguously a finalizer (currently just ",")
149
- lookahead === ","
150
-
151
- export type lookaheadIsFinalizing<
152
- lookahead extends string,
153
- unscanned extends string
154
- > = lookahead extends ">"
155
- ? unscanned extends `=${infer nextUnscanned}`
156
- ? nextUnscanned extends `=${string}`
157
- ? true
158
- : false
159
- : Scanner.skipWhitespace<unscanned> extends
160
- | ""
161
- | `${TerminatingChar}${string}`
162
- ? true
163
- : false
164
- : lookahead extends ","
165
- ? true
166
- : false
167
-
168
- export type shift<
169
- lookahead extends string,
170
- unscanned extends string
171
- > = `${lookahead}${unscanned}`
172
-
173
- export type shiftUntil<
174
- unscanned extends string,
175
- terminator extends string,
176
- scanned extends string = ""
177
- > = unscanned extends shift<infer lookahead, infer nextUnscanned>
178
- ? lookahead extends terminator
179
- ? scanned extends `${infer base}${EscapeToken}`
180
- ? shiftUntil<nextUnscanned, terminator, `${base}${lookahead}`>
181
- : [scanned, unscanned]
182
- : shiftUntil<nextUnscanned, terminator, `${scanned}${lookahead}`>
183
- : [scanned, ""]
184
-
185
- export type shiftUntilNot<
186
- unscanned extends string,
187
- nonTerminator extends string,
188
- scanned extends string = ""
189
- > = unscanned extends shift<infer lookahead, infer nextUnscanned>
190
- ? lookahead extends nonTerminator
191
- ? shiftUntilNot<nextUnscanned, nonTerminator, `${scanned}${lookahead}`>
192
- : [scanned, unscanned]
193
- : [scanned, ""]
194
-
195
- export type shiftUntilNextTerminator<unscanned extends string> = shiftUntil<
196
- unscanned,
197
- TerminatingChar
198
- >
199
-
200
- export type skipWhitespace<unscanned extends string> = shiftUntilNot<
201
- unscanned,
202
- WhiteSpaceToken
203
- >[1]
204
-
205
- export type shiftResult<scanned extends string, unscanned extends string> = [
206
- scanned,
207
- unscanned
208
- ]
209
- }
@@ -1,93 +0,0 @@
1
- import type { Root } from "@arktype/schema"
2
- import { throwParseError, type ErrorMessage } from "@arktype/util"
3
- import type { ParseContext } from "../../scope.js"
4
- import type { inferAst } from "../semantic/semantic.js"
5
- import { writeUnsatisfiableExpressionError } from "../semantic/validate.js"
6
- import { DynamicState, type DynamicStateWithRoot } from "./reduce/dynamic.js"
7
- import type { StringifiablePrefixOperator } from "./reduce/shared.js"
8
- import type { StaticState, state } from "./reduce/static.js"
9
- import { parseOperand } from "./shift/operand/operand.js"
10
- import {
11
- parseOperator,
12
- writeUnexpectedCharacterMessage
13
- } from "./shift/operator/operator.js"
14
-
15
- export const parseString = (def: string, ctx: ParseContext): Root =>
16
- ctx.scope.maybeResolveNode(def) ??
17
- ((def.endsWith("[]") &&
18
- ctx.scope.maybeResolveNode(def.slice(0, -2))?.array()) ||
19
- fullStringParse(def, ctx))
20
-
21
- /**
22
- * Try to parse the definition from right to left using the most common syntax.
23
- * This can be much more efficient for simple definitions.
24
- */
25
- export type parseString<def extends string, $, args> = def extends keyof $
26
- ? // def could also be a generic reference here, in which case it will
27
- // fail semantic validation because it has no args
28
- def
29
- : def extends `${infer child}[]`
30
- ? child extends keyof $
31
- ? [child, "[]"]
32
- : fullStringParse<def, $, args>
33
- : fullStringParse<def, $, args>
34
-
35
- export type inferString<def extends string, $, args> = inferAst<
36
- parseString<def, $, args>,
37
- $,
38
- args
39
- >
40
-
41
- export type BaseCompletions<$, args, otherSuggestions extends string = never> =
42
- | (keyof $ & string)
43
- | (keyof args & string)
44
- | StringifiablePrefixOperator
45
- | otherSuggestions
46
-
47
- export const fullStringParse = (def: string, ctx: ParseContext) => {
48
- const s = new DynamicState(def, ctx)
49
- parseOperand(s)
50
- const result = parseUntilFinalizer(s).root
51
- s.scanner.shiftUntilNonWhitespace()
52
- if (s.scanner.lookahead) {
53
- // throw a parse error if non-whitespace characters made it here without being parsed
54
- throwParseError(writeUnexpectedCharacterMessage(s.scanner.lookahead))
55
- }
56
- // TODO: would this ever happen?
57
- return result.isNever()
58
- ? throwParseError(writeUnsatisfiableExpressionError(def))
59
- : result
60
- }
61
-
62
- type fullStringParse<def extends string, $, args> = extractFinalizedResult<
63
- parseUntilFinalizer<state.initialize<def>, $, args>
64
- >
65
-
66
- export const parseUntilFinalizer = (s: DynamicState) => {
67
- while (s.finalizer === undefined) {
68
- next(s)
69
- }
70
- return s as DynamicStateWithRoot
71
- }
72
-
73
- export type parseUntilFinalizer<
74
- s extends StaticState,
75
- $,
76
- args
77
- > = s["finalizer"] extends undefined
78
- ? parseUntilFinalizer<next<s, $, args>, $, args>
79
- : s
80
-
81
- const next = (s: DynamicState) =>
82
- s.hasRoot() ? parseOperator(s) : parseOperand(s)
83
-
84
- type next<s extends StaticState, $, args> = s["root"] extends undefined
85
- ? parseOperand<s, $, args>
86
- : parseOperator<s, $, args>
87
-
88
- export type extractFinalizedResult<s extends StaticState> =
89
- s["finalizer"] extends ErrorMessage
90
- ? s["finalizer"]
91
- : s["finalizer"] extends ""
92
- ? s["root"]
93
- : state.error<writeUnexpectedCharacterMessage<`${s["finalizer"]}`>>