AST types
@swc-next/types provides TypeScript declarations for the AST, including TypeScript, JSX, and error recovery nodes. These types are also re-exported by the core, parser, codegen, and browser packages.
Program and nodes
Node is the union of supported node declarations, discriminated by type. Positions use UTF-16 code units with exclusive end offsets. Source positions on synthetic nodes are the caller's responsibility.
Language and source type
These are type aliases, not runtime enums. Use string values with the Parser API.
Compatibility
The JavaScript API produces ASTs compatible with the ESTree specification, using typescript-eslint's AST format for TypeScript and JSX nodes. The exported declarations describe these node shapes, including error recovery nodes.
Set the parser's preserveParens option to false to match typescript-eslint's representation of parentheses. The default preserves explicit parenthesized expression and type nodes.