Node interface and are classified by their SyntaxKind.
Base Node Interface
All AST nodes extend theNode interface:
Key Properties
Core Node Types
Declaration Nodes
VariableDeclaration- Variable declarationsFunctionDeclaration- Function declarationsClassDeclaration- Class declarationsInterfaceDeclaration- Interface declarationsTypeAliasDeclaration- Type alias declarationsEnumDeclaration- Enum declarationsParameterDeclaration- Parameter declarations
Expression Nodes
Expressions are nodes that can be evaluated to produce a value:Statement Nodes
Statements are executable units of code:Type Nodes
Type nodes represent TypeScript type annotations:Container Nodes
Some nodes act as containers for other declarations:LocalsContainer
Nodes that can contain local symbols:SourceFileFunctionDeclarationModuleDeclarationBlockForStatementCatchClause
FlowContainer
Nodes with control flow analysis:- Functions and methods
- Statements (if, while, for, etc.)
- Expressions with side effects
Common Node Patterns
Signature Declarations
FunctionDeclarationMethodDeclarationConstructorDeclarationCallSignatureDeclarationConstructSignatureDeclaration
Variable Declarations
Parameter Declarations
Working with Nodes
Type Guards
Use type guards to narrow node types:Traversing the AST
Node Relationships
Parent-Child
Every node (except the root) has a parent:Source File
Get the source file for any node:See Also
- SyntaxKind - Complete list of syntax kinds
- TypeFlags - Type system flags
- SymbolFlags - Symbol classification flags