bound
The names a binding (a variable, a parameter, a destructuring pattern) declares.
import { isBindingElement, isIdentifier } from "typescript/ast"; import type { BindingName, Node } from "typescript/ast"; export function bound(name: BindingName): string[] { if (isIdentifier(name)) return [name.text]; const out: string[] = []; for (const e of (name as unknown as { elements: readonly Node[] }).elements) if (isBindingElement(e) && e.name) out.push(...bound(e.name)); return out; }