initializerOf
What a const or let is initialized to (its initializer's expression), if it's one with an initializer.
import type { IR } from "#codebase/tcmts/core/hash"; import { childOf, declarationOf } from "#codebase/tcmts/core/ir"; export function initializerOf(ir: IR[] | string): IR[] | undefined { const d = declarationOf(ir); const init = d?.[0] === "VariableDeclaration" ? childOf(d, "initializer") : undefined; return Array.isArray(init) ? init : undefined; }