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 | JSXOpeningElement | JSXOpeningFragment | JSXSpreadAttribute | JSXSpreadChild | JSXMemberExpression | 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 | TSInterfaceDeclaration | TSInterfaceBody | TSInterfaceHeritage | TSIntersectionType | TSLiteralType | TSMappedType | TSMethodSignature | TSModuleBlock | TSModuleDeclaration | TSNamespaceExportDeclaration | TSNeverKeyword | TSNonNullExpression | TSNullKeyword | TSNumberKeyword | TSObjectKeyword | TSOptionalType | TSParameterProperty | TSParenthesizedType | TSPropertySignature | TSPublicKeyword | TSPrivateKeyword | TSProtectedKeyword | TSQualifiedName | TSReadonlyKeyword | TSRestType | TSStaticKeyword | TSStringKeyword | TSSymbolKeyword | TSThisType | TSTupleType | TSTypeAliasDeclaration | TSTypeAnnotation | TSTypeAssertion | TSTypeLiteral | TSTypeOperator | TSTypeParameter | TSTypeParameterDeclaration | TSTypeParameterInstantiation | TSTypePredicate | TSTypeQuery | TSTypeReference | TSUndefinedKeyword | TSUnionType | TSUnknownKeyword | TSVoidKeyword | UpdateExpression | UnaryExpression | 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 | TSNeverKeyword | TSNullKeyword | TSNumberKeyword | TSObjectKeyword | TSOptionalType | TSParenthesizedType | TSRestType | TSStringKeyword | TSSymbolKeyword | TSThisType | TSTupleType | TSTypeLiteral | TSTypeOperator | TSTypePredicate | TSTypeReference | TSTypeQuery | 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;
310 export interface AssignmentPattern extends BaseNode {
311 type: AST_NODE_TYPES.AssignmentPattern;
314 typeAnnotation?: TSTypeAnnotation;
316 decorators?: Decorator[];
318 export interface AwaitExpression extends BaseNode {
319 type: AST_NODE_TYPES.AwaitExpression;
320 argument: TSUnaryExpression;
322 export interface BigIntLiteral extends LiteralBase {
323 type: AST_NODE_TYPES.Literal;
324 value: bigint | null;
327 export interface BinaryExpression extends BinaryExpressionBase {
328 type: AST_NODE_TYPES.BinaryExpression;
330 export interface BlockStatement extends BaseNode {
331 type: AST_NODE_TYPES.BlockStatement;
334 export interface BooleanLiteral extends LiteralBase {
335 type: AST_NODE_TYPES.Literal;
338 export interface BreakStatement extends BaseNode {
339 type: AST_NODE_TYPES.BreakStatement;
340 label: Identifier | null;
342 export interface CallExpression extends CallExpressionBase {
343 type: AST_NODE_TYPES.CallExpression;
346 export interface CatchClause extends BaseNode {
347 type: AST_NODE_TYPES.CatchClause;
348 param: BindingName | null;
349 body: BlockStatement;
351 export interface ClassBody extends BaseNode {
352 type: AST_NODE_TYPES.ClassBody;
353 body: ClassElement[];
355 export interface ClassDeclaration extends ClassDeclarationBase {
356 type: AST_NODE_TYPES.ClassDeclaration;
358 export interface ClassExpression extends ClassDeclarationBase {
359 type: AST_NODE_TYPES.ClassExpression;
361 export interface ClassPropertyComputedName extends ClassPropertyComputedNameBase {
362 type: AST_NODE_TYPES.ClassProperty;
364 export interface ClassPropertyNonComputedName extends ClassPropertyNonComputedNameBase {
365 type: AST_NODE_TYPES.ClassProperty;
367 export interface ConditionalExpression extends BaseNode {
368 type: AST_NODE_TYPES.ConditionalExpression;
370 consequent: Expression;
371 alternate: Expression;
373 export interface ContinueStatement extends BaseNode {
374 type: AST_NODE_TYPES.ContinueStatement;
375 label: Identifier | null;
377 export interface DebuggerStatement extends BaseNode {
378 type: AST_NODE_TYPES.DebuggerStatement;
380 export interface Decorator extends BaseNode {
381 type: AST_NODE_TYPES.Decorator;
382 expression: LeftHandSideExpression;
384 export interface DoWhileStatement extends BaseNode {
385 type: AST_NODE_TYPES.DoWhileStatement;
389 export interface EmptyStatement extends BaseNode {
390 type: AST_NODE_TYPES.EmptyStatement;
392 export interface ExportAllDeclaration extends BaseNode {
393 type: AST_NODE_TYPES.ExportAllDeclaration;
394 source: Expression | null;
395 exportKind: 'type' | 'value';
396 exported: Identifier | null;
398 export interface ExportDefaultDeclaration extends BaseNode {
399 type: AST_NODE_TYPES.ExportDefaultDeclaration;
400 declaration: ExportDeclaration | Expression;
401 exportKind: 'type' | 'value';
403 export interface ExportNamedDeclaration extends BaseNode {
404 type: AST_NODE_TYPES.ExportNamedDeclaration;
405 declaration: ExportDeclaration | null;
406 specifiers: ExportSpecifier[];
407 source: Expression | null;
408 exportKind: 'type' | 'value';
410 export interface ExportSpecifier extends BaseNode {
411 type: AST_NODE_TYPES.ExportSpecifier;
413 exported: Identifier;
415 export interface ExpressionStatement extends BaseNode {
416 type: AST_NODE_TYPES.ExpressionStatement;
417 expression: Expression;
420 export interface ForInStatement extends BaseNode {
421 type: AST_NODE_TYPES.ForInStatement;
422 left: ForInitialiser;
426 export interface ForOfStatement extends BaseNode {
427 type: AST_NODE_TYPES.ForOfStatement;
428 left: ForInitialiser;
433 export interface ForStatement extends BaseNode {
434 type: AST_NODE_TYPES.ForStatement;
435 init: Expression | ForInitialiser | null;
436 test: Expression | null;
437 update: Expression | null;
440 export interface FunctionDeclaration extends FunctionDeclarationBase {
441 type: AST_NODE_TYPES.FunctionDeclaration;
442 body: BlockStatement;
444 export interface FunctionExpression extends FunctionDeclarationBase {
445 type: AST_NODE_TYPES.FunctionExpression;
446 body: BlockStatement;
448 export interface Identifier extends BaseNode {
449 type: AST_NODE_TYPES.Identifier;
451 typeAnnotation?: TSTypeAnnotation;
453 decorators?: Decorator[];
455 export interface IfStatement extends BaseNode {
456 type: AST_NODE_TYPES.IfStatement;
458 consequent: Statement;
459 alternate: Statement | null;
461 export interface ImportDeclaration extends BaseNode {
462 type: AST_NODE_TYPES.ImportDeclaration;
464 specifiers: ImportClause[];
465 importKind: 'type' | 'value';
467 export interface ImportDefaultSpecifier extends BaseNode {
468 type: AST_NODE_TYPES.ImportDefaultSpecifier;
471 export interface ImportExpression extends BaseNode {
472 type: AST_NODE_TYPES.ImportExpression;
475 export interface ImportNamespaceSpecifier extends BaseNode {
476 type: AST_NODE_TYPES.ImportNamespaceSpecifier;
479 export interface ImportSpecifier extends BaseNode {
480 type: AST_NODE_TYPES.ImportSpecifier;
482 imported: Identifier;
484 export interface JSXAttribute extends BaseNode {
485 type: AST_NODE_TYPES.JSXAttribute;
487 value: Literal | JSXExpression | null;
489 export interface JSXClosingElement extends BaseNode {
490 type: AST_NODE_TYPES.JSXClosingElement;
491 name: JSXTagNameExpression;
493 export interface JSXClosingFragment extends BaseNode {
494 type: AST_NODE_TYPES.JSXClosingFragment;
496 export interface JSXElement extends BaseNode {
497 type: AST_NODE_TYPES.JSXElement;
498 openingElement: JSXOpeningElement;
499 closingElement: JSXClosingElement | null;
500 children: JSXChild[];
502 export interface JSXEmptyExpression extends BaseNode {
503 type: AST_NODE_TYPES.JSXEmptyExpression;
505 export interface JSXExpressionContainer extends BaseNode {
506 type: AST_NODE_TYPES.JSXExpressionContainer;
507 expression: Expression | JSXEmptyExpression;
509 export interface JSXFragment extends BaseNode {
510 type: AST_NODE_TYPES.JSXFragment;
511 openingFragment: JSXOpeningFragment;
512 closingFragment: JSXClosingFragment;
513 children: JSXChild[];
515 export interface JSXIdentifier extends BaseNode {
516 type: AST_NODE_TYPES.JSXIdentifier;
519 export interface JSXMemberExpression extends BaseNode {
520 type: AST_NODE_TYPES.JSXMemberExpression;
521 object: JSXTagNameExpression;
522 property: JSXIdentifier;
524 export interface JSXOpeningElement extends BaseNode {
525 type: AST_NODE_TYPES.JSXOpeningElement;
526 typeParameters?: TSTypeParameterInstantiation;
527 selfClosing: boolean;
528 name: JSXTagNameExpression;
529 attributes: JSXAttribute[];
531 export interface JSXOpeningFragment extends BaseNode {
532 type: AST_NODE_TYPES.JSXOpeningFragment;
534 export interface JSXSpreadAttribute extends BaseNode {
535 type: AST_NODE_TYPES.JSXSpreadAttribute;
536 argument: Expression;
538 export interface JSXSpreadChild extends BaseNode {
539 type: AST_NODE_TYPES.JSXSpreadChild;
540 expression: Expression | JSXEmptyExpression;
542 export interface JSXText extends BaseNode {
543 type: AST_NODE_TYPES.JSXText;
547 export interface LabeledStatement extends BaseNode {
548 type: AST_NODE_TYPES.LabeledStatement;
552 export interface LogicalExpression extends BinaryExpressionBase {
553 type: AST_NODE_TYPES.LogicalExpression;
555 export interface MemberExpressionComputedName extends MemberExpressionComputedNameBase {
556 type: AST_NODE_TYPES.MemberExpression;
559 export interface MemberExpressionNonComputedName extends MemberExpressionNonComputedNameBase {
560 type: AST_NODE_TYPES.MemberExpression;
563 export interface MetaProperty extends BaseNode {
564 type: AST_NODE_TYPES.MetaProperty;
566 property: Identifier;
568 export interface MethodDefinitionComputedName extends MethodDefinitionComputedNameBase {
569 type: AST_NODE_TYPES.MethodDefinition;
571 export interface MethodDefinitionNonComputedName extends MethodDefinitionNonComputedNameBase {
572 type: AST_NODE_TYPES.MethodDefinition;
574 export interface NewExpression extends BaseNode {
575 type: AST_NODE_TYPES.NewExpression;
576 callee: LeftHandSideExpression;
577 arguments: Expression[];
578 typeParameters?: TSTypeParameterInstantiation;
580 export interface NumberLiteral extends LiteralBase {
581 type: AST_NODE_TYPES.Literal;
584 export interface NullLiteral extends LiteralBase {
585 type: AST_NODE_TYPES.Literal;
588 export interface ObjectExpression extends BaseNode {
589 type: AST_NODE_TYPES.ObjectExpression;
590 properties: ObjectLiteralElementLike[];
592 export interface ObjectPattern extends BaseNode {
593 type: AST_NODE_TYPES.ObjectPattern;
594 properties: (Property | RestElement)[];
595 typeAnnotation?: TSTypeAnnotation;
597 decorators?: Decorator[];
599 export interface OptionalCallExpression extends CallExpressionBase {
600 type: AST_NODE_TYPES.OptionalCallExpression;
603 export interface OptionalMemberExpressionComputedName extends MemberExpressionComputedNameBase {
604 type: AST_NODE_TYPES.OptionalMemberExpression;
607 export interface OptionalMemberExpressionNonComputedName extends MemberExpressionNonComputedNameBase {
608 type: AST_NODE_TYPES.OptionalMemberExpression;
611 export interface Program extends BaseNode {
612 type: AST_NODE_TYPES.Program;
614 sourceType: 'module' | 'script';
615 comments?: Comment[];
618 export interface PropertyComputedName extends PropertyBase {
619 key: PropertyNameComputed;
622 export interface PropertyNonComputedName extends PropertyBase {
623 key: PropertyNameNonComputed;
626 export interface RegExpLiteral extends LiteralBase {
627 type: AST_NODE_TYPES.Literal;
630 export interface RestElement extends BaseNode {
631 type: AST_NODE_TYPES.RestElement;
632 argument: DestructuringPattern;
633 typeAnnotation?: TSTypeAnnotation;
635 value?: AssignmentPattern;
636 decorators?: Decorator[];
638 export interface ReturnStatement extends BaseNode {
639 type: AST_NODE_TYPES.ReturnStatement;
640 argument: Expression | null;
642 export interface SequenceExpression extends BaseNode {
643 type: AST_NODE_TYPES.SequenceExpression;
644 expressions: Expression[];
646 export interface SpreadElement extends BaseNode {
647 type: AST_NODE_TYPES.SpreadElement;
648 argument: Expression;
650 export interface StringLiteral extends LiteralBase {
651 type: AST_NODE_TYPES.Literal;
654 export interface Super extends BaseNode {
655 type: AST_NODE_TYPES.Super;
657 export interface SwitchCase extends BaseNode {
658 type: AST_NODE_TYPES.SwitchCase;
659 test: Expression | null;
660 consequent: Statement[];
662 export interface SwitchStatement extends BaseNode {
663 type: AST_NODE_TYPES.SwitchStatement;
664 discriminant: Expression;
667 export interface TaggedTemplateExpression extends BaseNode {
668 type: AST_NODE_TYPES.TaggedTemplateExpression;
669 typeParameters?: TSTypeParameterInstantiation;
670 tag: LeftHandSideExpression;
671 quasi: TemplateLiteral;
673 export interface TemplateElement extends BaseNode {
674 type: AST_NODE_TYPES.TemplateElement;
681 export interface TemplateLiteral extends BaseNode {
682 type: AST_NODE_TYPES.TemplateLiteral;
683 quasis: TemplateElement[];
684 expressions: Expression[];
686 export interface ThisExpression extends BaseNode {
687 type: AST_NODE_TYPES.ThisExpression;
689 export interface ThrowStatement extends BaseNode {
690 type: AST_NODE_TYPES.ThrowStatement;
691 argument: Statement | TSAsExpression | null;
693 export interface TryStatement extends BaseNode {
694 type: AST_NODE_TYPES.TryStatement;
695 block: BlockStatement;
696 handler: CatchClause | null;
697 finalizer: BlockStatement;
699 export interface TSAbstractClassPropertyComputedName extends ClassPropertyComputedNameBase {
700 type: AST_NODE_TYPES.TSAbstractClassProperty;
702 export interface TSAbstractClassPropertyNonComputedName extends ClassPropertyNonComputedNameBase {
703 type: AST_NODE_TYPES.TSAbstractClassProperty;
705 export interface TSAbstractKeyword extends BaseNode {
706 type: AST_NODE_TYPES.TSAbstractKeyword;
708 export interface TSAbstractMethodDefinitionComputedName extends MethodDefinitionComputedNameBase {
709 type: AST_NODE_TYPES.TSAbstractMethodDefinition;
711 export interface TSAbstractMethodDefinitionNonComputedName extends MethodDefinitionNonComputedNameBase {
712 type: AST_NODE_TYPES.TSAbstractMethodDefinition;
714 export interface TSAnyKeyword extends BaseNode {
715 type: AST_NODE_TYPES.TSAnyKeyword;
717 export interface TSArrayType extends BaseNode {
718 type: AST_NODE_TYPES.TSArrayType;
719 elementType: TypeNode;
721 export interface TSAsExpression extends BaseNode {
722 type: AST_NODE_TYPES.TSAsExpression;
723 expression: Expression;
724 typeAnnotation: TypeNode;
726 export interface TSAsyncKeyword extends BaseNode {
727 type: AST_NODE_TYPES.TSAsyncKeyword;
729 export interface TSBigIntKeyword extends BaseNode {
730 type: AST_NODE_TYPES.TSBigIntKeyword;
732 export interface TSBooleanKeyword extends BaseNode {
733 type: AST_NODE_TYPES.TSBooleanKeyword;
735 export interface TSCallSignatureDeclaration extends FunctionSignatureBase {
736 type: AST_NODE_TYPES.TSCallSignatureDeclaration;
738 export interface TSClassImplements extends TSHeritageBase {
739 type: AST_NODE_TYPES.TSClassImplements;
741 export interface TSConditionalType extends BaseNode {
742 type: AST_NODE_TYPES.TSConditionalType;
744 extendsType: TypeNode;
748 export interface TSConstructorType extends FunctionSignatureBase {
749 type: AST_NODE_TYPES.TSConstructorType;
751 export interface TSConstructSignatureDeclaration extends FunctionSignatureBase {
752 type: AST_NODE_TYPES.TSConstructSignatureDeclaration;
754 export interface TSDeclareFunction extends FunctionDeclarationBase {
755 type: AST_NODE_TYPES.TSDeclareFunction;
757 export interface TSDeclareKeyword extends BaseNode {
758 type: AST_NODE_TYPES.TSDeclareKeyword;
760 export interface TSEmptyBodyFunctionExpression extends FunctionDeclarationBase {
761 type: AST_NODE_TYPES.TSEmptyBodyFunctionExpression;
764 export interface TSEnumDeclaration extends BaseNode {
765 type: AST_NODE_TYPES.TSEnumDeclaration;
767 members: TSEnumMember[];
770 modifiers?: Modifier[];
771 decorators?: Decorator[];
774 * this should only really happen in semantically invalid code (errors 1164 and 2452)
782 * enum Bar { ['a' + 'b'] }
784 export interface TSEnumMemberComputedName extends TSEnumMemberBase {
785 id: PropertyNameComputed;
788 export interface TSEnumMemberNonComputedName extends TSEnumMemberBase {
789 id: PropertyNameNonComputed;
792 export interface TSExportAssignment extends BaseNode {
793 type: AST_NODE_TYPES.TSExportAssignment;
794 expression: Expression;
796 export interface TSExportKeyword extends BaseNode {
797 type: AST_NODE_TYPES.TSExportKeyword;
799 export interface TSExternalModuleReference extends BaseNode {
800 type: AST_NODE_TYPES.TSExternalModuleReference;
801 expression: Expression;
803 export interface TSFunctionType extends FunctionSignatureBase {
804 type: AST_NODE_TYPES.TSFunctionType;
806 export interface TSImportEqualsDeclaration extends BaseNode {
807 type: AST_NODE_TYPES.TSImportEqualsDeclaration;
809 moduleReference: EntityName | TSExternalModuleReference;
812 export interface TSImportType extends BaseNode {
813 type: AST_NODE_TYPES.TSImportType;
816 qualifier: EntityName | null;
817 typeParameters: TSTypeParameterInstantiation | null;
819 export interface TSIndexedAccessType extends BaseNode {
820 type: AST_NODE_TYPES.TSIndexedAccessType;
821 objectType: TypeNode;
824 export interface TSIndexSignature extends BaseNode {
825 type: AST_NODE_TYPES.TSIndexSignature;
826 parameters: Parameter[];
827 typeAnnotation?: TSTypeAnnotation;
829 accessibility?: Accessibility;
833 export interface TSInferType extends BaseNode {
834 type: AST_NODE_TYPES.TSInferType;
835 typeParameter: TSTypeParameter;
837 export interface TSInterfaceDeclaration extends BaseNode {
838 type: AST_NODE_TYPES.TSInterfaceDeclaration;
839 body: TSInterfaceBody;
841 typeParameters?: TSTypeParameterDeclaration;
842 extends?: TSInterfaceHeritage[];
843 implements?: TSInterfaceHeritage[];
844 decorators?: Decorator[];
848 export interface TSInterfaceBody extends BaseNode {
849 type: AST_NODE_TYPES.TSInterfaceBody;
852 export interface TSInterfaceHeritage extends TSHeritageBase {
853 type: AST_NODE_TYPES.TSInterfaceHeritage;
855 export interface TSIntersectionType extends BaseNode {
856 type: AST_NODE_TYPES.TSIntersectionType;
859 export interface TSLiteralType extends BaseNode {
860 type: AST_NODE_TYPES.TSLiteralType;
861 literal: LiteralExpression | UnaryExpression | UpdateExpression;
863 export interface TSMappedType extends BaseNode {
864 type: AST_NODE_TYPES.TSMappedType;
865 typeParameter: TSTypeParameterDeclaration;
866 readonly?: boolean | '-' | '+';
867 optional?: boolean | '-' | '+';
868 typeAnnotation?: TypeNode;
870 export interface TSMethodSignatureComputedName extends TSMethodSignatureBase {
871 key: PropertyNameComputed;
874 export interface TSMethodSignatureNonComputedName extends TSMethodSignatureBase {
875 key: PropertyNameNonComputed;
878 export interface TSModuleBlock extends BaseNode {
879 type: AST_NODE_TYPES.TSModuleBlock;
882 export interface TSModuleDeclaration extends BaseNode {
883 type: AST_NODE_TYPES.TSModuleDeclaration;
884 id: Identifier | Literal;
885 body?: TSModuleBlock | TSModuleDeclaration;
888 modifiers?: Modifier[];
890 export interface TSNamespaceExportDeclaration extends BaseNode {
891 type: AST_NODE_TYPES.TSNamespaceExportDeclaration;
894 export interface TSNeverKeyword extends BaseNode {
895 type: AST_NODE_TYPES.TSNeverKeyword;
897 export interface TSNonNullExpression extends BaseNode {
898 type: AST_NODE_TYPES.TSNonNullExpression;
899 expression: Expression;
901 export interface TSNullKeyword extends BaseNode {
902 type: AST_NODE_TYPES.TSNullKeyword;
904 export interface TSNumberKeyword extends BaseNode {
905 type: AST_NODE_TYPES.TSNumberKeyword;
907 export interface TSObjectKeyword extends BaseNode {
908 type: AST_NODE_TYPES.TSObjectKeyword;
910 export interface TSOptionalType extends BaseNode {
911 type: AST_NODE_TYPES.TSOptionalType;
912 typeAnnotation: TypeNode;
914 export interface TSParameterProperty extends BaseNode {
915 type: AST_NODE_TYPES.TSParameterProperty;
916 accessibility?: Accessibility;
920 parameter: AssignmentPattern | BindingName | RestElement;
921 decorators?: Decorator[];
923 export interface TSParenthesizedType extends BaseNode {
924 type: AST_NODE_TYPES.TSParenthesizedType;
925 typeAnnotation: TypeNode;
927 export interface TSPropertySignatureComputedName extends TSPropertySignatureBase {
928 key: PropertyNameComputed;
931 export interface TSPropertySignatureNonComputedName extends TSPropertySignatureBase {
932 key: PropertyNameNonComputed;
935 export interface TSPublicKeyword extends BaseNode {
936 type: AST_NODE_TYPES.TSPublicKeyword;
938 export interface TSPrivateKeyword extends BaseNode {
939 type: AST_NODE_TYPES.TSPrivateKeyword;
941 export interface TSProtectedKeyword extends BaseNode {
942 type: AST_NODE_TYPES.TSProtectedKeyword;
944 export interface TSQualifiedName extends BaseNode {
945 type: AST_NODE_TYPES.TSQualifiedName;
949 export interface TSReadonlyKeyword extends BaseNode {
950 type: AST_NODE_TYPES.TSReadonlyKeyword;
952 export interface TSRestType extends BaseNode {
953 type: AST_NODE_TYPES.TSRestType;
954 typeAnnotation: TypeNode;
956 export interface TSStaticKeyword extends BaseNode {
957 type: AST_NODE_TYPES.TSStaticKeyword;
959 export interface TSStringKeyword extends BaseNode {
960 type: AST_NODE_TYPES.TSStringKeyword;
962 export interface TSSymbolKeyword extends BaseNode {
963 type: AST_NODE_TYPES.TSSymbolKeyword;
965 export interface TSThisType extends BaseNode {
966 type: AST_NODE_TYPES.TSThisType;
968 export interface TSTupleType extends BaseNode {
969 type: AST_NODE_TYPES.TSTupleType;
970 elementTypes: TypeNode[];
972 export interface TSTypeAliasDeclaration extends BaseNode {
973 type: AST_NODE_TYPES.TSTypeAliasDeclaration;
975 typeAnnotation: TypeNode;
977 typeParameters?: TSTypeParameterDeclaration;
979 export interface TSTypeAnnotation extends BaseNode {
980 type: AST_NODE_TYPES.TSTypeAnnotation;
981 typeAnnotation: TypeNode;
983 export interface TSTypeAssertion extends BaseNode {
984 type: AST_NODE_TYPES.TSTypeAssertion;
985 typeAnnotation: TypeNode;
986 expression: Expression;
988 export interface TSTypeLiteral extends BaseNode {
989 type: AST_NODE_TYPES.TSTypeLiteral;
990 members: TypeElement[];
992 export interface TSTypeOperator extends BaseNode {
993 type: AST_NODE_TYPES.TSTypeOperator;
994 operator: 'keyof' | 'unique' | 'readonly';
995 typeAnnotation?: TypeNode;
997 export interface TSTypeParameter extends BaseNode {
998 type: AST_NODE_TYPES.TSTypeParameter;
1000 constraint?: TypeNode;
1003 export interface TSTypeParameterDeclaration extends BaseNode {
1004 type: AST_NODE_TYPES.TSTypeParameterDeclaration;
1005 params: TSTypeParameter[];
1007 export interface TSTypeParameterInstantiation extends BaseNode {
1008 type: AST_NODE_TYPES.TSTypeParameterInstantiation;
1011 export interface TSTypePredicate extends BaseNode {
1012 type: AST_NODE_TYPES.TSTypePredicate;
1014 parameterName: Identifier | TSThisType;
1015 typeAnnotation: TSTypeAnnotation | null;
1017 export interface TSTypeQuery extends BaseNode {
1018 type: AST_NODE_TYPES.TSTypeQuery;
1019 exprName: EntityName;
1021 export interface TSTypeReference extends BaseNode {
1022 type: AST_NODE_TYPES.TSTypeReference;
1023 typeName: EntityName;
1024 typeParameters?: TSTypeParameterInstantiation;
1026 export interface TSUndefinedKeyword extends BaseNode {
1027 type: AST_NODE_TYPES.TSUndefinedKeyword;
1029 export interface TSUnionType extends BaseNode {
1030 type: AST_NODE_TYPES.TSUnionType;
1033 export interface TSUnknownKeyword extends BaseNode {
1034 type: AST_NODE_TYPES.TSUnknownKeyword;
1036 export interface TSVoidKeyword extends BaseNode {
1037 type: AST_NODE_TYPES.TSVoidKeyword;
1039 export interface UpdateExpression extends UnaryExpressionBase {
1040 type: AST_NODE_TYPES.UpdateExpression;
1041 operator: '++' | '--';
1043 export interface UnaryExpression extends UnaryExpressionBase {
1044 type: AST_NODE_TYPES.UnaryExpression;
1045 operator: '+' | '-' | '!' | '~' | 'delete' | 'void' | 'typeof';
1047 export interface VariableDeclaration extends BaseNode {
1048 type: AST_NODE_TYPES.VariableDeclaration;
1049 declarations: VariableDeclarator[];
1050 kind: 'let' | 'const' | 'var';
1053 export interface VariableDeclarator extends BaseNode {
1054 type: AST_NODE_TYPES.VariableDeclarator;
1056 init: Expression | null;
1059 export interface WhileStatement extends BaseNode {
1060 type: AST_NODE_TYPES.WhileStatement;
1064 export interface WithStatement extends BaseNode {
1065 type: AST_NODE_TYPES.WithStatement;
1069 export interface YieldExpression extends BaseNode {
1070 type: AST_NODE_TYPES.YieldExpression;
1072 argument?: Expression;
1075 //# sourceMappingURL=ts-estree.d.ts.map