Skip to main content
Module

x/ts_morph/ts_morph.d.ts>Node#forEachDescendant

TypeScript Compiler API wrapper for static analysis and programmatic code changes.
Very Popular
Go to Latest
method Node.prototype.forEachDescendant
import { Node } from "https://deno.land/x/ts_morph@15.1.0/ts_morph.d.ts";

Invokes the cbNode callback for each descendant and the cbNodeArray for every array of nodes stored in properties of the node and descendant nodes. If cbNodeArray is not defined, then it will pass every element of the array to cbNode.

Parameters

cbNode: (node: Node, traversal: ForEachDescendantTraversalControl) => T | undefined
  • Callback invoked for each descendant.
optional
cbNodeArray: (nodes: Node[], traversal: ForEachDescendantTraversalControl) => T | undefined
  • Callback invoked for each array of nodes.

Returns

T | undefined

The first truthy value returned by a callback.