From a80cd86d4776762b5a4cf140434262dff7f83a73 Mon Sep 17 00:00:00 2001 From: ObserverOfTime Date: Sat, 30 Aug 2025 23:11:13 +0300 Subject: [PATCH] fix(cli): fix DSL type declarations (cherry picked from commit ca27fb5d43705991c210dc784265a7389cc74dbe) --- cli/npm/dsl.d.ts | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/cli/npm/dsl.d.ts b/cli/npm/dsl.d.ts index bfc89d5c..3ad9ea2a 100644 --- a/cli/npm/dsl.d.ts +++ b/cli/npm/dsl.d.ts @@ -34,12 +34,10 @@ type Rule = | SymbolRule | TokenRule; -class RustRegex { +declare class RustRegex { value: string; - constructor(pattern: string) { - this.value = pattern; - } + constructor(pattern: string); } type RuleOrLiteral = Rule | RegExp | RustRegex | string; @@ -263,7 +261,7 @@ declare function optional(rule: RuleOrLiteral): ChoiceRule; * @see https://docs.oracle.com/cd/E19504-01/802-5880/6i9k05dh3/index.html */ declare const prec: { - (value: String | number, rule: RuleOrLiteral): PrecRule; + (value: string | number, rule: RuleOrLiteral): PrecRule; /** * Marks the given rule as left-associative (and optionally applies a @@ -279,7 +277,7 @@ declare const prec: { * @see https://docs.oracle.com/cd/E19504-01/802-5880/6i9k05dh3/index.html */ left(rule: RuleOrLiteral): PrecLeftRule; - left(value: String | number, rule: RuleOrLiteral): PrecLeftRule; + left(value: string | number, rule: RuleOrLiteral): PrecLeftRule; /** * Marks the given rule as right-associative (and optionally applies a @@ -295,7 +293,7 @@ declare const prec: { * @see https://docs.oracle.com/cd/E19504-01/802-5880/6i9k05dh3/index.html */ right(rule: RuleOrLiteral): PrecRightRule; - right(value: String | number, rule: RuleOrLiteral): PrecRightRule; + right(value: string | number, rule: RuleOrLiteral): PrecRightRule; /** * Marks the given rule with a numerical precedence which will be used to @@ -312,7 +310,7 @@ declare const prec: { * * @see https://www.gnu.org/software/bison/manual/html_node/Generalized-LR-Parsing.html */ - dynamic(value: String | number, rule: RuleOrLiteral): PrecDynamicRule; + dynamic(value: string | number, rule: RuleOrLiteral): PrecDynamicRule; }; /** @@ -359,7 +357,7 @@ declare function sym(name: Name): SymbolRule; /** * Marks the given rule as producing only a single token. Tree-sitter's - * default is to treat each String or RegExp literal in the grammar as a + * default is to treat each string or RegExp literal in the grammar as a * separate token. Each token is matched separately by the lexer and * returned as its own leaf node in the tree. The token function allows * you to express a complex rule using the DSL functions (rather