isErased
Whether a part of a definition's IR is only types, erased when the code is compiled, so nothing in it runs: a
type, typeArguments or typeParameters slot (a parameter's, variable's or return type, as T, satisfies T,
f<T>(); typeof x in a type is in one), a type or interface declared inside code, and implements. The rest
is code that runs: a global read, called, constructed, or tested with instanceof or a typeof expression.
import type { IR } from "#codebase/tcmts/core/hash"; export function isErased(node: IR): boolean { if (!Array.isArray(node)) return false; const tag = node[0]; return ( tag === "type" || tag === "typeArguments" || tag === "typeParameters" || tag === "InterfaceDeclaration" || tag === "TypeAliasDeclaration" || (tag === "HeritageClause" && node[1] === "implements") ); }