Skip to content

Commit 2f897b4

Browse files
committed
Change QueryResult to be QueryCapture and QueryMatch
matches/captures return 2 different types of object so this change corrects the return types
1 parent a7a6139 commit 2f897b4

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

lib/binding_web/tree-sitter-web.d.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,14 @@ declare module 'web-tree-sitter' {
137137
query(source: string): Query;
138138
}
139139

140-
interface QueryResult {
140+
interface QueryCapture {
141+
name: string;
142+
node: SyntaxNode;
143+
}
144+
145+
interface QueryMatch {
141146
pattern: number;
142-
captures: { name: string; node: SyntaxNode }[];
147+
captures: QueryCapture[];
143148
}
144149

145150
interface PredicateResult {
@@ -151,8 +156,8 @@ declare module 'web-tree-sitter' {
151156
captureNames: string[];
152157

153158
delete(): void;
154-
matches(node: SyntaxNode, startPosition?: Point, endPosition?: Point): QueryResult[];
155-
captures(node: SyntaxNode, startPosition?: Point, endPosition?: Point): QueryResult[];
159+
matches(node: SyntaxNode, startPosition?: Point, endPosition?: Point): QueryMatch[];
160+
captures(node: SyntaxNode, startPosition?: Point, endPosition?: Point): QueryCapture[];
156161
predicatesForPattern(patternIndex: number): PredicateResult[];
157162
}
158163
}

0 commit comments

Comments
 (0)