Skip to content

⬅️ Back to Table of Contents

📄 getSpecificNode.ts

📊 Analysis Summary

Metric Count
🔧 Functions 1
📦 Imports 3
📊 Variables & Constants 2

📚 Table of Contents

🛠️ File Location:

📂 packages/scope-manager/tests/test-utils/getSpecificNode.ts

📦 Imports

Name Source
AST_NODE_TYPES @typescript-eslint/types
TSESTree @typescript-eslint/types
simpleTraverse @typescript-eslint/typescript-estree

Variables & Constants

Name Type Kind Value Exported
node TSESTree.Node | null | undefined let/var null
res any const cb ? cb(n) : n

Functions

getSpecificNode(ast: TSESTree.Node, selector: Selector, cb: (node: Node) => boolean | null | undefined): Node

Code
export function getSpecificNode<
  Selector extends AST_NODE_TYPES,
  Node extends Extract<TSESTree.Node, { type: Selector }>,
>(
  ast: TSESTree.Node,
  selector: Selector,
  cb?: (node: Node) => boolean | null | undefined,
): Node;
  • Parameters:
  • ast: TSESTree.Node
  • selector: Selector
  • cb: (node: Node) => boolean | null | undefined
  • Return Type: Node