AST (Abstract Syntax Tree)
ts-morph: A Full Guide to Available Nodes and How to Use Them ts-morph is a TypeScript library that wraps the raw TypeScript Compiler API in friendlier, chainable classes. Instead of manually walking ts.Node objects and calling low-level compiler functions, you work with typed wrapper classes — ClassDeclaration , FunctionDeclaration , CallExpression , and roughly 220+ others — each exposing methods for reading, navigating, and rewriting that piece of source. Every wrapper ultimately extends a base Node class, so understanding that base class first makes everything else click into place. 1. The Node base class Every specific node type ( ClassDeclaration , Identifier , IfStatement , etc.) inherits from Node . This gives all of them a shared set of capabilities: Identity & text getKind() — returns the SyntaxKind enum value (e.g. SyntaxKind.ClassDeclaration ). getKindName() — the human-readable string version of the kind. getText() — the...