Skip to main content
Module

x/ts_morph/mod.ts>Node#getParentWhileKind

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

Goes up the parents (ancestors) of the node while the parent is the specified syntax kind. Returns undefined if the initial parent is not the specified syntax kind.

Type Parameters

TKind extends SyntaxKind

Parameters

kind: TKind
  • Syntax kind to check for.

Returns

KindToNodeMappings[TKind] | undefined