UNPKG

661 BTypeScriptView Raw
1/// <reference types="esquery" />
2import { type Node, type Selector } from './index';
3/**
4 * @public
5 * Find AST `Nodes` within a given AST `Node` matching a `Selector`.
6 *
7 * @param node - the `Node` to be searched. This could be a TypeScript [`SourceFile`](https://github.com/microsoft/TypeScript/blob/main/src/services/types.ts#L159), or a `Node` from a previous query.
8 * @param selector - a TSQuery `Selector` (using the [ESQuery selector syntax](https://github.com/estools/esquery)).
9 * @returns an `Array` of `Nodes` which match the `Selector`.
10 */
11export declare function match<T extends Node = Node>(node: Node, selector: string | Selector): Array<T>;