1 import { AST_NODE_TYPES } from './ast-node-types';
2 import { AST_TOKEN_TYPES } from './ast-token-types';
3 export interface LineAndColumnData {
5 * Line number (1-indexed)
9 * Column number on the line (0-indexed)
13 export interface SourceLocation {
15 * The position of the first character of the parsed source region
17 start: LineAndColumnData;
19 * The position of the first character after the parsed source region
21 end: LineAndColumnData;
23 export declare type Range = [number, number];
24 export interface BaseNode {
26 * The source location information of the node.
30 * An array of two numbers.
31 * Both numbers are a 0-based index which is the position in the array of source code characters.
32 * The first is the start position of the node, the second is the end position of the node.
36 * The parent node of the current node
40 interface BaseToken extends BaseNode {
43 export interface BooleanToken extends BaseToken {
44 type: AST_TOKEN_TYPES.Boolean;
46 export interface IdentifierToken extends BaseToken {
47 type: AST_TOKEN_TYPES.Identifier;
49 export interface JSXIdentifierToken extends BaseToken {
50 type: AST_TOKEN_TYPES.JSXIdentifier;
52 export interface JSXTextToken extends BaseToken {
53 type: AST_TOKEN_TYPES.JSXText;
55 export interface KeywordToken extends BaseToken {
56 type: AST_TOKEN_TYPES.Keyword;
58 export interface NullToken extends BaseToken {
59 type: AST_TOKEN_TYPES.Null;
61 export interface NumericToken extends BaseToken {
62 type: AST_TOKEN_TYPES.Numeric;
64 export interface PunctuatorToken extends BaseToken {
65 type: AST_TOKEN_TYPES.Punctuator;
67 export interface RegularExpressionToken extends BaseToken {
68 type: AST_TOKEN_TYPES.RegularExpression;
74 export interface StringToken extends BaseToken {
75 type: AST_TOKEN_TYPES.String;
77 export interface TemplateToken extends BaseToken {
78 type: AST_TOKEN_TYPES.Template;
80 export interface BlockComment extends BaseToken {
81 type: AST_TOKEN_TYPES.Block;
83 export interface LineComment extends BaseToken {
84 type: AST_TOKEN_TYPES.Line;
86 export declare type Comment = BlockComment | LineComment;
87 export declare type Token = BooleanToken | Comment | IdentifierToken | JSXIdentifierToken | JSXTextToken | KeywordToken | NullToken | NumericToken | PunctuatorToken | RegularExpressionToken | StringToken | TemplateToken;
88 export declare type OptionalRangeAndLoc<T> = Pick<T, Exclude<keyof T, 'range' | 'loc'>> & {
92 export declare type Node = ArrayExpression | ArrayPattern | ArrowFunctionExpression | AssignmentExpression | AssignmentPattern | AwaitExpression | BigIntLiteral | BinaryExpression | BlockStatement | BreakStatement | CallExpression | CatchClause | ClassBody | ClassDeclaration | ClassExpression | ClassProperty | ConditionalExpression | ContinueStatement | DebuggerStatement | Decorator | DoWhileStatement | EmptyStatement | ExportAllDeclaration | ExportDefaultDeclaration | ExportNamedDeclaration | ExportSpecifier | ExpressionStatement | ForInStatement | ForOfStatement | ForStatement | FunctionDeclaration | FunctionExpression | Identifier | IfStatement | ImportDeclaration | ImportDefaultSpecifier | ImportExpression | ImportNamespaceSpecifier | ImportSpecifier | JSXAttribute | JSXClosingElement | JSXClosingFragment | JSXElement | JSXEmptyExpression | JSXExpressionContainer | JSXFragment | JSXIdentifier | JSXMemberExpression | JSXOpeningElement | JSXOpeningFragment | JSXSpreadAttribute | JSXSpreadChild | JSXText | LabeledStatement | Literal | LogicalExpression | MemberExpression | MetaProperty | MethodDefinition | NewExpression | ObjectExpression | ObjectPattern | OptionalCallExpression | OptionalMemberExpression | Program | Property | RestElement | ReturnStatement | SequenceExpression | SpreadElement | Super | SwitchCase | SwitchStatement | TaggedTemplateExpression | TemplateElement | TemplateLiteral | ThisExpression | ThrowStatement | TryStatement | TSAbstractClassProperty | TSAbstractKeyword | TSAbstractMethodDefinition | TSAnyKeyword | TSArrayType | TSAsExpression | TSAsyncKeyword | TSBigIntKeyword | TSBooleanKeyword | TSCallSignatureDeclaration | TSClassImplements | TSConditionalType | TSConstructorType | TSConstructSignatureDeclaration | TSDeclareFunction | TSDeclareKeyword | TSEmptyBodyFunctionExpression | TSEnumDeclaration | TSEnumMember | TSExportAssignment | TSExportKeyword | TSExternalModuleReference | TSFunctionType | TSImportEqualsDeclaration | TSImportType | TSIndexedAccessType | TSIndexSignature | TSInferType | TSInterfaceBody | TSInterfaceDeclaration | TSInterfaceHeritage | TSIntersectionType | TSLiteralType | TSMappedType | TSMethodSignature | TSModuleBlock | TSModuleDeclaration | TSNamedTupleMember | TSNamespaceExportDeclaration | TSNeverKeyword | TSNonNullExpression | TSNullKeyword | TSNumberKeyword | TSObjectKeyword | TSOptionalType | TSParameterProperty | TSParenthesizedType | TSPrivateKeyword | TSPropertySignature | TSProtectedKeyword | TSPublicKeyword | TSQualifiedName | TSReadonlyKeyword | TSRestType | TSStaticKeyword | TSStringKeyword | TSSymbolKeyword | TSThisType | TSTupleType | TSTypeAliasDeclaration | TSTypeAnnotation | TSTypeAssertion | TSTypeLiteral | TSTypeOperator | TSTypeParameter | TSTypeParameterDeclaration | TSTypeParameterInstantiation | TSTypePredicate | TSTypeQuery | TSTypeReference | TSUndefinedKeyword | TSUnionType | TSUnknownKeyword | TSVoidKeyword | UnaryExpression | UpdateExpression | VariableDeclaration | VariableDeclarator | WhileStatement | WithStatement | YieldExpression;
93 export declare type Accessibility = 'public' | 'protected' | 'private';
94 export declare type BindingPattern = ArrayPattern | ObjectPattern;
95 export declare type BindingName = BindingPattern | Identifier;
96 export declare type ClassElement = ClassProperty | MethodDefinition | TSAbstractClassProperty | TSAbstractMethodDefinition | TSIndexSignature;
97 export declare type ClassProperty = ClassPropertyComputedName | ClassPropertyNonComputedName;
98 export declare type DeclarationStatement = ClassDeclaration | ClassExpression | ExportDefaultDeclaration | ExportAllDeclaration | ExportNamedDeclaration | FunctionDeclaration | TSDeclareFunction | TSImportEqualsDeclaration | TSInterfaceDeclaration | TSModuleDeclaration | TSNamespaceExportDeclaration | TSTypeAliasDeclaration | TSEnumDeclaration;
99 export declare type DestructuringPattern = Identifier | ObjectPattern | ArrayPattern | RestElement | AssignmentPattern | MemberExpression;
100 export declare type EntityName = Identifier | TSQualifiedName;
101 export declare type ExportDeclaration = ClassDeclaration | ClassExpression | FunctionDeclaration | TSDeclareFunction | TSEnumDeclaration | TSInterfaceDeclaration | TSModuleDeclaration | TSTypeAliasDeclaration | VariableDeclaration;
102 export declare type Expression = ArrowFunctionExpression | AssignmentExpression | BinaryExpression | ConditionalExpression | ImportExpression | JSXClosingElement | JSXClosingFragment | JSXExpressionContainer | JSXOpeningElement | JSXOpeningFragment | JSXSpreadChild | LogicalExpression | NewExpression | RestElement | SequenceExpression | SpreadElement | TSAsExpression | TSUnaryExpression | YieldExpression;
103 export declare type ForInitialiser = Expression | VariableDeclaration;
104 export declare type ImportClause = ImportDefaultSpecifier | ImportNamespaceSpecifier | ImportSpecifier;
105 export declare type IterationStatement = DoWhileStatement | ForInStatement | ForOfStatement | ForStatement | WhileStatement;
106 export declare type JSXChild = JSXElement | JSXExpression | JSXFragment | JSXText;
107 export declare type JSXExpression = JSXEmptyExpression | JSXSpreadChild | JSXExpressionContainer;
108 export declare type JSXTagNameExpression = JSXIdentifier | JSXMemberExpression;
109 export declare type LeftHandSideExpression = CallExpression | ClassExpression | ClassDeclaration | FunctionExpression | LiteralExpression | MemberExpression | OptionalCallExpression | OptionalMemberExpression | PrimaryExpression | TaggedTemplateExpression | TSNonNullExpression | TSAsExpression | ArrowFunctionExpression;
110 export declare type Literal = BigIntLiteral | BooleanLiteral | NumberLiteral | NullLiteral | RegExpLiteral | StringLiteral;
111 export declare type LiteralExpression = Literal | TemplateLiteral;
112 export declare type MemberExpression = MemberExpressionComputedName | MemberExpressionNonComputedName;
113 export declare type MethodDefinition = MethodDefinitionComputedName | MethodDefinitionNonComputedName;
114 export declare type Modifier = TSAbstractKeyword | TSAsyncKeyword | TSDeclareKeyword | TSExportKeyword | TSPublicKeyword | TSPrivateKeyword | TSProtectedKeyword | TSReadonlyKeyword | TSStaticKeyword;
115 export declare type ObjectLiteralElementLike = MethodDefinition | Property | SpreadElement | TSAbstractMethodDefinition;
116 export declare type OptionalMemberExpression = OptionalMemberExpressionComputedName | OptionalMemberExpressionNonComputedName;
117 export declare type Parameter = ArrayPattern | AssignmentPattern | Identifier | ObjectPattern | RestElement | TSParameterProperty;
118 export declare type PrimaryExpression = ArrayExpression | ArrayPattern | ClassExpression | FunctionExpression | Identifier | JSXElement | JSXFragment | JSXOpeningElement | Literal | LiteralExpression | MetaProperty | ObjectExpression | ObjectPattern | Super | TemplateLiteral | ThisExpression | TSNullKeyword;
119 export declare type Property = PropertyComputedName | PropertyNonComputedName;
120 export declare type PropertyName = PropertyNameComputed | PropertyNameNonComputed;
121 export declare type PropertyNameComputed = Expression;
122 export declare type PropertyNameNonComputed = Identifier | StringLiteral | NumberLiteral;
123 export declare type Statement = BlockStatement | BreakStatement | ContinueStatement | DebuggerStatement | DeclarationStatement | EmptyStatement | ExpressionStatement | IfStatement | IterationStatement | ImportDeclaration | LabeledStatement | TSModuleBlock | ReturnStatement | SwitchStatement | ThrowStatement | TryStatement | VariableDeclaration | WithStatement;
124 export declare type TSAbstractClassProperty = TSAbstractClassPropertyComputedName | TSAbstractClassPropertyNonComputedName;
125 export declare type TSAbstractMethodDefinition = TSAbstractMethodDefinitionComputedName | TSAbstractMethodDefinitionNonComputedName;
126 export declare type TSMethodSignature = TSMethodSignatureComputedName | TSMethodSignatureNonComputedName;
127 export declare type TSPropertySignature = TSPropertySignatureComputedName | TSPropertySignatureNonComputedName;
128 export declare type TSEnumMember = TSEnumMemberComputedName | TSEnumMemberNonComputedName;
129 export declare type TSUnaryExpression = AwaitExpression | LeftHandSideExpression | TSTypeAssertion | UnaryExpression | UpdateExpression;
130 export declare type TypeElement = TSCallSignatureDeclaration | TSConstructSignatureDeclaration | TSIndexSignature | TSMethodSignature | TSPropertySignature;
131 export declare type TypeNode = TSAnyKeyword | TSArrayType | TSBigIntKeyword | TSBooleanKeyword | TSConditionalType | TSConstructorType | TSFunctionType | TSImportType | TSIndexedAccessType | TSInferType | TSInterfaceHeritage | TSIntersectionType | TSLiteralType | TSMappedType | TSNamedTupleMember | TSNeverKeyword | TSNullKeyword | TSNumberKeyword | TSObjectKeyword | TSOptionalType | TSParenthesizedType | TSRestType | TSStringKeyword | TSSymbolKeyword | TSThisType | TSTupleType | TSTypeLiteral | TSTypeOperator | TSTypePredicate | TSTypeQuery | TSTypeReference | TSUndefinedKeyword | TSUnionType | TSUnknownKeyword | TSVoidKeyword;
132 interface BinaryExpressionBase extends BaseNode {
137 interface CallExpressionBase extends BaseNode {
138 callee: LeftHandSideExpression;
139 arguments: Expression[];
140 typeParameters?: TSTypeParameterInstantiation;
143 interface ClassDeclarationBase extends BaseNode {
144 typeParameters?: TSTypeParameterDeclaration;
145 superTypeParameters?: TSTypeParameterInstantiation;
146 id: Identifier | null;
148 superClass: LeftHandSideExpression | null;
149 implements?: TSClassImplements[];
152 decorators?: Decorator[];
154 /** this should not be directly used - instead use ClassPropertyComputedNameBase or ClassPropertyNonComputedNameBase */
155 interface ClassPropertyBase extends BaseNode {
157 value: Expression | null;
162 decorators?: Decorator[];
163 accessibility?: Accessibility;
166 typeAnnotation?: TSTypeAnnotation;
168 interface ClassPropertyComputedNameBase extends ClassPropertyBase {
169 key: PropertyNameComputed;
172 interface ClassPropertyNonComputedNameBase extends ClassPropertyBase {
173 key: PropertyNameNonComputed;
176 interface FunctionDeclarationBase extends BaseNode {
177 id: Identifier | null;
182 body?: BlockStatement | null;
183 returnType?: TSTypeAnnotation;
184 typeParameters?: TSTypeParameterDeclaration;
187 interface FunctionSignatureBase extends BaseNode {
189 returnType?: TSTypeAnnotation;
190 typeParameters?: TSTypeParameterDeclaration;
192 interface LiteralBase extends BaseNode {
194 value: string | boolean | null | number | RegExp | bigint;
200 /** this should not be directly used - instead use MemberExpressionComputedNameBase or MemberExpressionNonComputedNameBase */
201 interface MemberExpressionBase extends BaseNode {
202 object: LeftHandSideExpression;
203 property: Expression | Identifier;
207 interface MemberExpressionComputedNameBase extends MemberExpressionBase {
208 property: Expression;
211 interface MemberExpressionNonComputedNameBase extends MemberExpressionBase {
212 property: Identifier;
215 /** this should not be directly used - instead use MethodDefinitionComputedNameBase or MethodDefinitionNonComputedNameBase */
216 interface MethodDefinitionBase extends BaseNode {
218 value: FunctionExpression | TSEmptyBodyFunctionExpression;
221 kind: 'method' | 'get' | 'set' | 'constructor';
223 decorators?: Decorator[];
224 accessibility?: Accessibility;
225 typeParameters?: TSTypeParameterDeclaration;
227 interface MethodDefinitionComputedNameBase extends MethodDefinitionBase {
228 key: PropertyNameComputed;
231 interface MethodDefinitionNonComputedNameBase extends MethodDefinitionBase {
232 key: PropertyNameNonComputed;
235 interface PropertyBase extends BaseNode {
236 type: AST_NODE_TYPES.Property;
238 value: Expression | AssignmentPattern | BindingName | TSEmptyBodyFunctionExpression;
243 kind: 'init' | 'get' | 'set';
245 interface TSEnumMemberBase extends BaseNode {
246 type: AST_NODE_TYPES.TSEnumMember;
247 id: PropertyNameNonComputed | PropertyNameComputed;
248 initializer?: Expression;
251 interface TSHeritageBase extends BaseNode {
252 expression: Expression;
253 typeParameters?: TSTypeParameterInstantiation;
255 interface TSMethodSignatureBase extends BaseNode {
256 type: AST_NODE_TYPES.TSMethodSignature;
261 returnType?: TSTypeAnnotation;
263 typeParameters?: TSTypeParameterDeclaration;
264 accessibility?: Accessibility;
268 interface TSPropertySignatureBase extends BaseNode {
269 type: AST_NODE_TYPES.TSPropertySignature;
273 typeAnnotation?: TSTypeAnnotation;
274 initializer?: Expression;
278 accessibility?: Accessibility;
280 interface UnaryExpressionBase extends BaseNode {
283 argument: LeftHandSideExpression | Literal | UnaryExpression;
285 export interface ArrayExpression extends BaseNode {
286 type: AST_NODE_TYPES.ArrayExpression;
287 elements: Expression[];
289 export interface ArrayPattern extends BaseNode {
290 type: AST_NODE_TYPES.ArrayPattern;
291 elements: (DestructuringPattern | null)[];
292 typeAnnotation?: TSTypeAnnotation;
294 decorators?: Decorator[];
296 export interface ArrowFunctionExpression extends BaseNode {
297 type: AST_NODE_TYPES.ArrowFunctionExpression;
301 body: Expression | BlockStatement;
304 returnType?: TSTypeAnnotation;
305 typeParameters?: TSTypeParameterDeclaration;
307 export interface AssignmentExpression extends BinaryExpressionBase {
308 type: AST_NODE_TYPES.AssignmentExpression;
309 operator: '-=' | '??=' | '**=' | '*=' | '/=' | '&&=' | '&=' | '%=' | '^=' | '+=' | '<<=' | '=' | '>>=' | '>>>=' | '|=' | '||=';
311 export interface AssignmentPattern extends BaseNode {
312 type: AST_NODE_TYPES.AssignmentPattern;
315 typeAnnotation?: TSTypeAnnotation;
317 decorators?: Decorator[];
319 export interface AwaitExpression extends BaseNode {
320 type: AST_NODE_TYPES.AwaitExpression;
321 argument: TSUnaryExpression;
323 export interface BigIntLiteral extends LiteralBase {
324 type: AST_NODE_TYPES.Literal;
325 value: bigint | null;
328 export interface BinaryExpression extends BinaryExpressionBase {
329 type: AST_NODE_TYPES.BinaryExpression;
331 export interface BlockStatement extends BaseNode {
332 type: AST_NODE_TYPES.BlockStatement;
335 export interface BooleanLiteral extends LiteralBase {
336 type: AST_NODE_TYPES.Literal;
339 export interface BreakStatement extends BaseNode {
340 type: AST_NODE_TYPES.BreakStatement;
341 label: Identifier | null;
343 export interface CallExpression extends CallExpressionBase {
344 type: AST_NODE_TYPES.CallExpression;
347 export interface CatchClause extends BaseNode {
348 type: AST_NODE_TYPES.CatchClause;
349 param: BindingName | null;
350 body: BlockStatement;
352 export interface ClassBody extends BaseNode {
353 type: AST_NODE_TYPES.ClassBody;
354 body: ClassElement[];
356 export interface ClassDeclaration extends ClassDeclarationBase {
357 type: AST_NODE_TYPES.ClassDeclaration;
359 export interface ClassExpression extends ClassDeclarationBase {
360 type: AST_NODE_TYPES.ClassExpression;
362 export interface ClassPropertyComputedName extends ClassPropertyComputedNameBase {
363 type: AST_NODE_TYPES.ClassProperty;
365 export interface ClassPropertyNonComputedName extends ClassPropertyNonComputedNameBase {
366 type: AST_NODE_TYPES.ClassProperty;
368 export interface ConditionalExpression extends BaseNode {
369 type: AST_NODE_TYPES.ConditionalExpression;
371 consequent: Expression;
372 alternate: Expression;
374 export interface ContinueStatement extends BaseNode {
375 type: AST_NODE_TYPES.ContinueStatement;
376 label: Identifier | null;
378 export interface DebuggerStatement extends BaseNode {
379 type: AST_NODE_TYPES.DebuggerStatement;
381 export interface Decorator extends BaseNode {
382 type: AST_NODE_TYPES.Decorator;
383 expression: LeftHandSideExpression;
385 export interface DoWhileStatement extends BaseNode {
386 type: AST_NODE_TYPES.DoWhileStatement;
390 export interface EmptyStatement extends BaseNode {
391 type: AST_NODE_TYPES.EmptyStatement;
393 export interface ExportAllDeclaration extends BaseNode {
394 type: AST_NODE_TYPES.ExportAllDeclaration;
395 source: Expression | null;
396 exportKind: 'type' | 'value';
397 exported: Identifier | null;
399 export interface ExportDefaultDeclaration extends BaseNode {
400 type: AST_NODE_TYPES.ExportDefaultDeclaration;
401 declaration: ExportDeclaration | Expression;
402 exportKind: 'type' | 'value';
404 export interface ExportNamedDeclaration extends BaseNode {
405 type: AST_NODE_TYPES.ExportNamedDeclaration;
406 declaration: ExportDeclaration | null;
407 specifiers: ExportSpecifier[];
408 source: Expression | null;
409 exportKind: 'type' | 'value';
411 export interface ExportSpecifier extends BaseNode {
412 type: AST_NODE_TYPES.ExportSpecifier;
414 exported: Identifier;
416 export interface ExpressionStatement extends BaseNode {
417 type: AST_NODE_TYPES.ExpressionStatement;
418 expression: Expression;
421 export interface ForInStatement extends BaseNode {
422 type: AST_NODE_TYPES.ForInStatement;
423 left: ForInitialiser;
427 export interface ForOfStatement extends BaseNode {
428 type: AST_NODE_TYPES.ForOfStatement;
429 left: ForInitialiser;
434 export interface ForStatement extends BaseNode {
435 type: AST_NODE_TYPES.ForStatement;
436 init: Expression | ForInitialiser | null;
437 test: Expression | null;
438 update: Expression | null;
441 export interface FunctionDeclaration extends FunctionDeclarationBase {
442 type: AST_NODE_TYPES.FunctionDeclaration;
443 body: BlockStatement;
444 decorators?: Decorator[];
446 export interface FunctionExpression extends FunctionDeclarationBase {
447 type: AST_NODE_TYPES.FunctionExpression;
448 body: BlockStatement;
450 export interface Identifier extends BaseNode {
451 type: AST_NODE_TYPES.Identifier;
453 typeAnnotation?: TSTypeAnnotation;
455 decorators?: Decorator[];
457 export interface IfStatement extends BaseNode {
458 type: AST_NODE_TYPES.IfStatement;
460 consequent: Statement;
461 alternate: Statement | null;
463 export interface ImportDeclaration extends BaseNode {
464 type: AST_NODE_TYPES.ImportDeclaration;
466 specifiers: ImportClause[];
467 importKind: 'type' | 'value';
469 export interface ImportDefaultSpecifier extends BaseNode {
470 type: AST_NODE_TYPES.ImportDefaultSpecifier;
473 export interface ImportExpression extends BaseNode {
474 type: AST_NODE_TYPES.ImportExpression;
477 export interface ImportNamespaceSpecifier extends BaseNode {
478 type: AST_NODE_TYPES.ImportNamespaceSpecifier;
481 export interface ImportSpecifier extends BaseNode {
482 type: AST_NODE_TYPES.ImportSpecifier;
484 imported: Identifier;
486 export interface JSXAttribute extends BaseNode {
487 type: AST_NODE_TYPES.JSXAttribute;
489 value: Literal | JSXExpression | null;
491 export interface JSXClosingElement extends BaseNode {
492 type: AST_NODE_TYPES.JSXClosingElement;
493 name: JSXTagNameExpression;
495 export interface JSXClosingFragment extends BaseNode {
496 type: AST_NODE_TYPES.JSXClosingFragment;
498 export interface JSXElement extends BaseNode {
499 type: AST_NODE_TYPES.JSXElement;
500 openingElement: JSXOpeningElement;
501 closingElement: JSXClosingElement | null;
502 children: JSXChild[];
504 export interface JSXEmptyExpression extends BaseNode {
505 type: AST_NODE_TYPES.JSXEmptyExpression;
507 export interface JSXExpressionContainer extends BaseNode {
508 type: AST_NODE_TYPES.JSXExpressionContainer;
509 expression: Expression | JSXEmptyExpression;
511 export interface JSXFragment extends BaseNode {
512 type: AST_NODE_TYPES.JSXFragment;
513 openingFragment: JSXOpeningFragment;
514 closingFragment: JSXClosingFragment;
515 children: JSXChild[];
517 export interface JSXIdentifier extends BaseNode {
518 type: AST_NODE_TYPES.JSXIdentifier;
521 export interface JSXMemberExpression extends BaseNode {
522 type: AST_NODE_TYPES.JSXMemberExpression;
523 object: JSXTagNameExpression;
524 property: JSXIdentifier;
526 export interface JSXOpeningElement extends BaseNode {
527 type: AST_NODE_TYPES.JSXOpeningElement;
528 typeParameters?: TSTypeParameterInstantiation;
529 selfClosing: boolean;
530 name: JSXTagNameExpression;
531 attributes: JSXAttribute[];
533 export interface JSXOpeningFragment extends BaseNode {
534 type: AST_NODE_TYPES.JSXOpeningFragment;
536 export interface JSXSpreadAttribute extends BaseNode {
537 type: AST_NODE_TYPES.JSXSpreadAttribute;
538 argument: Expression;
540 export interface JSXSpreadChild extends BaseNode {
541 type: AST_NODE_TYPES.JSXSpreadChild;
542 expression: Expression | JSXEmptyExpression;
544 export interface JSXText extends BaseNode {
545 type: AST_NODE_TYPES.JSXText;
549 export interface LabeledStatement extends BaseNode {
550 type: AST_NODE_TYPES.LabeledStatement;
554 export interface LogicalExpression extends BinaryExpressionBase {
555 type: AST_NODE_TYPES.LogicalExpression;
557 export interface MemberExpressionComputedName extends MemberExpressionComputedNameBase {
558 type: AST_NODE_TYPES.MemberExpression;
561 export interface MemberExpressionNonComputedName extends MemberExpressionNonComputedNameBase {
562 type: AST_NODE_TYPES.MemberExpression;
565 export interface MetaProperty extends BaseNode {
566 type: AST_NODE_TYPES.MetaProperty;
568 property: Identifier;
570 export interface MethodDefinitionComputedName extends MethodDefinitionComputedNameBase {
571 type: AST_NODE_TYPES.MethodDefinition;
573 export interface MethodDefinitionNonComputedName extends MethodDefinitionNonComputedNameBase {
574 type: AST_NODE_TYPES.MethodDefinition;
576 export interface NewExpression extends BaseNode {
577 type: AST_NODE_TYPES.NewExpression;
578 callee: LeftHandSideExpression;
579 arguments: Expression[];
580 typeParameters?: TSTypeParameterInstantiation;
582 export interface NumberLiteral extends LiteralBase {
583 type: AST_NODE_TYPES.Literal;
586 export interface NullLiteral extends LiteralBase {
587 type: AST_NODE_TYPES.Literal;
590 export interface ObjectExpression extends BaseNode {
591 type: AST_NODE_TYPES.ObjectExpression;
592 properties: ObjectLiteralElementLike[];
594 export interface ObjectPattern extends BaseNode {
595 type: AST_NODE_TYPES.ObjectPattern;
596 properties: (Property | RestElement)[];
597 typeAnnotation?: TSTypeAnnotation;
599 decorators?: Decorator[];
601 export interface OptionalCallExpression extends CallExpressionBase {
602 type: AST_NODE_TYPES.OptionalCallExpression;
605 export interface OptionalMemberExpressionComputedName extends MemberExpressionComputedNameBase {
606 type: AST_NODE_TYPES.OptionalMemberExpression;
609 export interface OptionalMemberExpressionNonComputedName extends MemberExpressionNonComputedNameBase {
610 type: AST_NODE_TYPES.OptionalMemberExpression;
613 export interface Program extends BaseNode {
614 type: AST_NODE_TYPES.Program;
616 sourceType: 'module' | 'script';
617 comments?: Comment[];
620 export interface PropertyComputedName extends PropertyBase {
621 key: PropertyNameComputed;
624 export interface PropertyNonComputedName extends PropertyBase {
625 key: PropertyNameNonComputed;
628 export interface RegExpLiteral extends LiteralBase {
629 type: AST_NODE_TYPES.Literal;
632 export interface RestElement extends BaseNode {
633 type: AST_NODE_TYPES.RestElement;
634 argument: DestructuringPattern;
635 typeAnnotation?: TSTypeAnnotation;
637 value?: AssignmentPattern;
638 decorators?: Decorator[];
640 export interface ReturnStatement extends BaseNode {
641 type: AST_NODE_TYPES.ReturnStatement;
642 argument: Expression | null;
644 export interface SequenceExpression extends BaseNode {
645 type: AST_NODE_TYPES.SequenceExpression;
646 expressions: Expression[];
648 export interface SpreadElement extends BaseNode {
649 type: AST_NODE_TYPES.SpreadElement;
650 argument: Expression;
652 export interface StringLiteral extends LiteralBase {
653 type: AST_NODE_TYPES.Literal;
656 export interface Super extends BaseNode {
657 type: AST_NODE_TYPES.Super;
659 export interface SwitchCase extends BaseNode {
660 type: AST_NODE_TYPES.SwitchCase;
661 test: Expression | null;
662 consequent: Statement[];
664 export interface SwitchStatement extends BaseNode {
665 type: AST_NODE_TYPES.SwitchStatement;
666 discriminant: Expression;
669 export interface TaggedTemplateExpression extends BaseNode {
670 type: AST_NODE_TYPES.TaggedTemplateExpression;
671 typeParameters?: TSTypeParameterInstantiation;
672 tag: LeftHandSideExpression;
673 quasi: TemplateLiteral;
675 export interface TemplateElement extends BaseNode {
676 type: AST_NODE_TYPES.TemplateElement;
683 export interface TemplateLiteral extends BaseNode {
684 type: AST_NODE_TYPES.TemplateLiteral;
685 quasis: TemplateElement[];
686 expressions: Expression[];
688 export interface ThisExpression extends BaseNode {
689 type: AST_NODE_TYPES.ThisExpression;
691 export interface ThrowStatement extends BaseNode {
692 type: AST_NODE_TYPES.ThrowStatement;
693 argument: Statement | TSAsExpression | null;
695 export interface TryStatement extends BaseNode {
696 type: AST_NODE_TYPES.TryStatement;
697 block: BlockStatement;
698 handler: CatchClause | null;
699 finalizer: BlockStatement;
701 export interface TSAbstractClassPropertyComputedName extends ClassPropertyComputedNameBase {
702 type: AST_NODE_TYPES.TSAbstractClassProperty;
704 export interface TSAbstractClassPropertyNonComputedName extends ClassPropertyNonComputedNameBase {
705 type: AST_NODE_TYPES.TSAbstractClassProperty;
707 export interface TSAbstractKeyword extends BaseNode {
708 type: AST_NODE_TYPES.TSAbstractKeyword;
710 export interface TSAbstractMethodDefinitionComputedName extends MethodDefinitionComputedNameBase {
711 type: AST_NODE_TYPES.TSAbstractMethodDefinition;
713 export interface TSAbstractMethodDefinitionNonComputedName extends MethodDefinitionNonComputedNameBase {
714 type: AST_NODE_TYPES.TSAbstractMethodDefinition;
716 export interface TSAnyKeyword extends BaseNode {
717 type: AST_NODE_TYPES.TSAnyKeyword;
719 export interface TSArrayType extends BaseNode {
720 type: AST_NODE_TYPES.TSArrayType;
721 elementType: TypeNode;
723 export interface TSAsExpression extends BaseNode {
724 type: AST_NODE_TYPES.TSAsExpression;
725 expression: Expression;
726 typeAnnotation: TypeNode;
728 export interface TSAsyncKeyword extends BaseNode {
729 type: AST_NODE_TYPES.TSAsyncKeyword;
731 export interface TSBigIntKeyword extends BaseNode {
732 type: AST_NODE_TYPES.TSBigIntKeyword;
734 export interface TSBooleanKeyword extends BaseNode {
735 type: AST_NODE_TYPES.TSBooleanKeyword;
737 export interface TSCallSignatureDeclaration extends FunctionSignatureBase {
738 type: AST_NODE_TYPES.TSCallSignatureDeclaration;
740 export interface TSClassImplements extends TSHeritageBase {
741 type: AST_NODE_TYPES.TSClassImplements;
743 export interface TSConditionalType extends BaseNode {
744 type: AST_NODE_TYPES.TSConditionalType;
746 extendsType: TypeNode;
750 export interface TSConstructorType extends FunctionSignatureBase {
751 type: AST_NODE_TYPES.TSConstructorType;
753 export interface TSConstructSignatureDeclaration extends FunctionSignatureBase {
754 type: AST_NODE_TYPES.TSConstructSignatureDeclaration;
756 export interface TSDeclareFunction extends FunctionDeclarationBase {
757 type: AST_NODE_TYPES.TSDeclareFunction;
759 export interface TSDeclareKeyword extends BaseNode {
760 type: AST_NODE_TYPES.TSDeclareKeyword;
762 export interface TSEmptyBodyFunctionExpression extends FunctionDeclarationBase {
763 type: AST_NODE_TYPES.TSEmptyBodyFunctionExpression;
766 export interface TSEnumDeclaration extends BaseNode {
767 type: AST_NODE_TYPES.TSEnumDeclaration;
769 members: TSEnumMember[];
772 modifiers?: Modifier[];
773 decorators?: Decorator[];
776 * this should only really happen in semantically invalid code (errors 1164 and 2452)
784 * enum Bar { ['a' + 'b'] }
786 export interface TSEnumMemberComputedName extends TSEnumMemberBase {
787 id: PropertyNameComputed;
790 export interface TSEnumMemberNonComputedName extends TSEnumMemberBase {
791 id: PropertyNameNonComputed;
794 export interface TSExportAssignment extends BaseNode {
795 type: AST_NODE_TYPES.TSExportAssignment;
796 expression: Expression;
798 export interface TSExportKeyword extends BaseNode {
799 type: AST_NODE_TYPES.TSExportKeyword;
801 export interface TSExternalModuleReference extends BaseNode {
802 type: AST_NODE_TYPES.TSExternalModuleReference;
803 expression: Expression;
805 export interface TSFunctionType extends FunctionSignatureBase {
806 type: AST_NODE_TYPES.TSFunctionType;
808 export interface TSImportEqualsDeclaration extends BaseNode {
809 type: AST_NODE_TYPES.TSImportEqualsDeclaration;
811 moduleReference: EntityName | TSExternalModuleReference;
814 export interface TSImportType extends BaseNode {
815 type: AST_NODE_TYPES.TSImportType;
818 qualifier: EntityName | null;
819 typeParameters: TSTypeParameterInstantiation | null;
821 export interface TSIndexedAccessType extends BaseNode {
822 type: AST_NODE_TYPES.TSIndexedAccessType;
823 objectType: TypeNode;
826 export interface TSIndexSignature extends BaseNode {
827 type: AST_NODE_TYPES.TSIndexSignature;
828 parameters: Parameter[];
829 typeAnnotation?: TSTypeAnnotation;
831 accessibility?: Accessibility;
835 export interface TSInferType extends BaseNode {
836 type: AST_NODE_TYPES.TSInferType;
837 typeParameter: TSTypeParameter;
839 export interface TSInterfaceDeclaration extends BaseNode {
840 type: AST_NODE_TYPES.TSInterfaceDeclaration;
841 body: TSInterfaceBody;
843 typeParameters?: TSTypeParameterDeclaration;
844 extends?: TSInterfaceHeritage[];
845 implements?: TSInterfaceHeritage[];
846 decorators?: Decorator[];
850 export interface TSInterfaceBody extends BaseNode {
851 type: AST_NODE_TYPES.TSInterfaceBody;
854 export interface TSInterfaceHeritage extends TSHeritageBase {
855 type: AST_NODE_TYPES.TSInterfaceHeritage;
857 export interface TSIntersectionType extends BaseNode {
858 type: AST_NODE_TYPES.TSIntersectionType;
861 export interface TSLiteralType extends BaseNode {
862 type: AST_NODE_TYPES.TSLiteralType;
863 literal: LiteralExpression | UnaryExpression | UpdateExpression;
865 export interface TSMappedType extends BaseNode {
866 type: AST_NODE_TYPES.TSMappedType;
867 typeParameter: TSTypeParameterDeclaration;
868 readonly?: boolean | '-' | '+';
869 optional?: boolean | '-' | '+';
870 typeAnnotation?: TypeNode;
872 export interface TSMethodSignatureComputedName extends TSMethodSignatureBase {
873 key: PropertyNameComputed;
876 export interface TSMethodSignatureNonComputedName extends TSMethodSignatureBase {
877 key: PropertyNameNonComputed;
880 export interface TSModuleBlock extends BaseNode {
881 type: AST_NODE_TYPES.TSModuleBlock;
884 export interface TSModuleDeclaration extends BaseNode {
885 type: AST_NODE_TYPES.TSModuleDeclaration;
886 id: Identifier | Literal;
887 body?: TSModuleBlock | TSModuleDeclaration;
890 modifiers?: Modifier[];
892 export interface TSNamespaceExportDeclaration extends BaseNode {
893 type: AST_NODE_TYPES.TSNamespaceExportDeclaration;
896 export interface TSNeverKeyword extends BaseNode {
897 type: AST_NODE_TYPES.TSNeverKeyword;
899 export interface TSNonNullExpression extends BaseNode {
900 type: AST_NODE_TYPES.TSNonNullExpression;
901 expression: Expression;
903 export interface TSNullKeyword extends BaseNode {
904 type: AST_NODE_TYPES.TSNullKeyword;
906 export interface TSNumberKeyword extends BaseNode {
907 type: AST_NODE_TYPES.TSNumberKeyword;
909 export interface TSObjectKeyword extends BaseNode {
910 type: AST_NODE_TYPES.TSObjectKeyword;
912 export interface TSOptionalType extends BaseNode {
913 type: AST_NODE_TYPES.TSOptionalType;
914 typeAnnotation: TypeNode;
916 export interface TSParameterProperty extends BaseNode {
917 type: AST_NODE_TYPES.TSParameterProperty;
918 accessibility?: Accessibility;
922 parameter: AssignmentPattern | BindingName | RestElement;
923 decorators?: Decorator[];
925 export interface TSParenthesizedType extends BaseNode {
926 type: AST_NODE_TYPES.TSParenthesizedType;
927 typeAnnotation: TypeNode;
929 export interface TSPropertySignatureComputedName extends TSPropertySignatureBase {
930 key: PropertyNameComputed;
933 export interface TSPropertySignatureNonComputedName extends TSPropertySignatureBase {
934 key: PropertyNameNonComputed;
937 export interface TSPublicKeyword extends BaseNode {
938 type: AST_NODE_TYPES.TSPublicKeyword;
940 export interface TSPrivateKeyword extends BaseNode {
941 type: AST_NODE_TYPES.TSPrivateKeyword;
943 export interface TSProtectedKeyword extends BaseNode {
944 type: AST_NODE_TYPES.TSProtectedKeyword;
946 export interface TSQualifiedName extends BaseNode {
947 type: AST_NODE_TYPES.TSQualifiedName;
951 export interface TSReadonlyKeyword extends BaseNode {
952 type: AST_NODE_TYPES.TSReadonlyKeyword;
954 export interface TSRestType extends BaseNode {
955 type: AST_NODE_TYPES.TSRestType;
956 typeAnnotation: TypeNode;
958 export interface TSStaticKeyword extends BaseNode {
959 type: AST_NODE_TYPES.TSStaticKeyword;
961 export interface TSStringKeyword extends BaseNode {
962 type: AST_NODE_TYPES.TSStringKeyword;
964 export interface TSSymbolKeyword extends BaseNode {
965 type: AST_NODE_TYPES.TSSymbolKeyword;
967 export interface TSThisType extends BaseNode {
968 type: AST_NODE_TYPES.TSThisType;
970 export interface TSNamedTupleMember extends BaseNode {
971 type: AST_NODE_TYPES.TSNamedTupleMember;
972 elementType: TypeNode;
976 export interface TSTupleType extends BaseNode {
977 type: AST_NODE_TYPES.TSTupleType;
978 elementTypes: TypeNode[];
980 export interface TSTypeAliasDeclaration extends BaseNode {
981 type: AST_NODE_TYPES.TSTypeAliasDeclaration;
983 typeAnnotation: TypeNode;
985 typeParameters?: TSTypeParameterDeclaration;
987 export interface TSTypeAnnotation extends BaseNode {
988 type: AST_NODE_TYPES.TSTypeAnnotation;
989 typeAnnotation: TypeNode;
991 export interface TSTypeAssertion extends BaseNode {
992 type: AST_NODE_TYPES.TSTypeAssertion;
993 typeAnnotation: TypeNode;
994 expression: Expression;
996 export interface TSTypeLiteral extends BaseNode {
997 type: AST_NODE_TYPES.TSTypeLiteral;
998 members: TypeElement[];
1000 export interface TSTypeOperator extends BaseNode {
1001 type: AST_NODE_TYPES.TSTypeOperator;
1002 operator: 'keyof' | 'unique' | 'readonly';
1003 typeAnnotation?: TypeNode;
1005 export interface TSTypeParameter extends BaseNode {
1006 type: AST_NODE_TYPES.TSTypeParameter;
1008 constraint?: TypeNode;
1011 export interface TSTypeParameterDeclaration extends BaseNode {
1012 type: AST_NODE_TYPES.TSTypeParameterDeclaration;
1013 params: TSTypeParameter[];
1015 export interface TSTypeParameterInstantiation extends BaseNode {
1016 type: AST_NODE_TYPES.TSTypeParameterInstantiation;
1019 export interface TSTypePredicate extends BaseNode {
1020 type: AST_NODE_TYPES.TSTypePredicate;
1022 parameterName: Identifier | TSThisType;
1023 typeAnnotation: TSTypeAnnotation | null;
1025 export interface TSTypeQuery extends BaseNode {
1026 type: AST_NODE_TYPES.TSTypeQuery;
1027 exprName: EntityName;
1029 export interface TSTypeReference extends BaseNode {
1030 type: AST_NODE_TYPES.TSTypeReference;
1031 typeName: EntityName;
1032 typeParameters?: TSTypeParameterInstantiation;
1034 export interface TSUndefinedKeyword extends BaseNode {
1035 type: AST_NODE_TYPES.TSUndefinedKeyword;
1037 export interface TSUnionType extends BaseNode {
1038 type: AST_NODE_TYPES.TSUnionType;
1041 export interface TSUnknownKeyword extends BaseNode {
1042 type: AST_NODE_TYPES.TSUnknownKeyword;
1044 export interface TSVoidKeyword extends BaseNode {
1045 type: AST_NODE_TYPES.TSVoidKeyword;
1047 export interface UpdateExpression extends UnaryExpressionBase {
1048 type: AST_NODE_TYPES.UpdateExpression;
1049 operator: '++' | '--';
1051 export interface UnaryExpression extends UnaryExpressionBase {
1052 type: AST_NODE_TYPES.UnaryExpression;
1053 operator: '+' | '-' | '!' | '~' | 'delete' | 'void' | 'typeof';
1055 export interface VariableDeclaration extends BaseNode {
1056 type: AST_NODE_TYPES.VariableDeclaration;
1057 declarations: VariableDeclarator[];
1058 kind: 'let' | 'const' | 'var';
1061 export interface VariableDeclarator extends BaseNode {
1062 type: AST_NODE_TYPES.VariableDeclarator;
1064 init: Expression | null;
1067 export interface WhileStatement extends BaseNode {
1068 type: AST_NODE_TYPES.WhileStatement;
1072 export interface WithStatement extends BaseNode {
1073 type: AST_NODE_TYPES.WithStatement;
1077 export interface YieldExpression extends BaseNode {
1078 type: AST_NODE_TYPES.YieldExpression;
1080 argument?: Expression;
1083 //# sourceMappingURL=ts-estree.d.ts.map