UNPKG

cannabis

Version:
24 lines (23 loc) 1.19 kB
import { ts } from 'ts-simple-ast-extra'; import { ASTNode } from "../node/astNode"; import { Node } from './queryAst'; /** * Will query given code or node and if there is any error, like query syntax error, it will fail silently, * returning an empty array. */ export declare function queryAll<T extends ASTNode = Node>(q: string, codeOrNode: string | ts.Node | ASTNode): T[]; /** * Will query given code or node and if there is any error, like query syntax error, it will fail silently, * returning an empty array. */ export declare function queryAllOrThrow<T extends ASTNode = Node>(q: string, codeOrNode: string | ts.Node | ASTNode): T[]; /** * Will query given code or node and if there is any error, like query syntax error, it will fail silently, * returning an empty array. */ export declare function queryOne<T extends ASTNode = Node>(q: string, codeOrNode: string | ts.Node | ASTNode): T | undefined; /** * Will query given code or node and if there is any error, like query syntax error, it will fail silently, * returning an empty array. */ export declare function queryOneOrThrow<T extends ASTNode = Node>(q: string, codeOrNode: string | ts.Node | ASTNode): T;