mirror of
https://github.com/cursorless-dev/cursorless.git
synced 2024-10-04 21:07:21 +03:00
Fix typings
This commit is contained in:
parent
ae6fb8e0eb
commit
dfd704101f
@ -182,14 +182,14 @@ const nodeMatchers = {
|
||||
return null;
|
||||
}
|
||||
|
||||
return simpleSelectionExtractor(node.keyNode);
|
||||
return simpleSelectionExtractor(node.keyNode!);
|
||||
},
|
||||
pairValue(editor: TextEditor, node: SyntaxNode) {
|
||||
if (node.type !== "pair") {
|
||||
return null;
|
||||
}
|
||||
|
||||
return simpleSelectionExtractor(node.valueNode);
|
||||
return simpleSelectionExtractor(node.valueNode!);
|
||||
},
|
||||
argumentOrParameter: delimitedMatcher(
|
||||
(node) =>
|
||||
@ -217,8 +217,7 @@ const nodeMatchers = {
|
||||
// }
|
||||
if (
|
||||
node.type === "public_field_definition" &&
|
||||
// @ts-ignore
|
||||
node.valueNode.type === "arrow_function"
|
||||
node.valueNode!.type === "arrow_function"
|
||||
) {
|
||||
return simpleSelectionExtractor(node);
|
||||
}
|
||||
@ -234,8 +233,7 @@ const nodeMatchers = {
|
||||
|
||||
if (
|
||||
child.type === "variable_declarator" &&
|
||||
// @ts-ignore
|
||||
child.valueNode.type === "arrow_function"
|
||||
child.valueNode!.type === "arrow_function"
|
||||
) {
|
||||
return simpleSelectionExtractor(node);
|
||||
}
|
||||
|
@ -190,7 +190,7 @@ function transformSelection(
|
||||
.parent!.children.map((sibling) =>
|
||||
nodeMatcher(selection.editor, sibling)
|
||||
)
|
||||
.filter((selection) => selection != null);
|
||||
.filter((selection) => selection != null) as SelectionWithContext[];
|
||||
} else {
|
||||
matchedSelections = [matchedSelection];
|
||||
}
|
||||
|
@ -87,6 +87,10 @@ declare module "tree-sitter" {
|
||||
previousSibling: SyntaxNode | null;
|
||||
previousNamedSibling: SyntaxNode | null;
|
||||
|
||||
// Added these because they sometimes exist
|
||||
valueNode: SyntaxNode | null;
|
||||
keyNode: SyntaxNode | null;
|
||||
|
||||
hasChanges(): boolean;
|
||||
hasError(): boolean;
|
||||
isMissing(): boolean;
|
||||
|
Loading…
Reference in New Issue
Block a user