declarationOf
A symbol's declaration, as a node (fetched from the compiler: its value declaration, else its first).
import type { Node } from "typescript/ast"; import type { Symbol } from "typescript/sync"; export function declarationOf(symbol: Symbol): Node | undefined { const handle = symbol.valueDeclaration ?? symbol.declarations?.[0]; try { return handle?.resolve() as Node | undefined; } catch { return undefined; } }