eslint-codemod-utils
Version:
A collection of AST helper functions for more complex ESLint rule fixes.
9 lines (8 loc) • 349 B
TypeScript
import type { ESLintNode } from '../types';
/**
* Traverses the node's parents until the specified `type` is found. If no `type` is found
* in the traversal it will return `null`.
*/
export declare function closestOfType<NodeType extends ESLintNode['type']>(node: ESLintNode, type: NodeType): Extract<ESLintNode, {
type: NodeType;
}> | null;