1import { AST_NODE_TYPES } from './ast-node-types'; 2import { AST_TOKEN_TYPES } from './ast-token-types'; 3 4export interface LineAndColumnData { 5 /** 6 * Line number (1-indexed) 7 */ 8 line: number; 9 /** 10 * Column number on the line (0-indexed) 11 */ 12 column: number; 13} 14export interface SourceLocation { 15 /** 16 * The position of the first character of the parsed source region 17 */ 18 start: LineAndColumnData; 19 /** 20 * The position of the first character after the parsed source region 21 */ 22 end: LineAndColumnData; 23} 24export type Range = [number, number]; 25 26export interface BaseNode { 27 /** 28 * The source location information of the node. 29 */ 30 loc: SourceLocation; 31 /** 32 * An array of two numbers. 33 * Both numbers are a 0-based index which is the position in the array of source code characters. 34 * The first is the start position of the node, the second is the end position of the node. 35 */ 36 range: Range; 37 /** 38 * The parent node of the current node 39 */ 40 parent?: Node; 41 42 // every node *will* have a type, but let the nodes define their own exact string 43 // type: string; 44 45 // we don't ever set this from within ts-estree 46 // source?: string | null; 47} 48 49/* 50 * Token and Comment are pseudo-nodes to represent pieces of source code 51 * 52 * NOTE: 53 * They are not included in the `Node` union below on purpose because they 54 * are not ever included as part of the standard AST tree. 55 */ 56interface BaseToken extends BaseNode { 57 value: string; 58} 59 60export interface BooleanToken extends BaseToken { 61 type: AST_TOKEN_TYPES.Boolean; 62} 63 64export interface IdentifierToken extends BaseToken { 65 type: AST_TOKEN_TYPES.Identifier; 66} 67 68export interface JSXIdentifierToken extends BaseToken { 69 type: AST_TOKEN_TYPES.JSXIdentifier; 70} 71 72export interface JSXTextToken extends BaseToken { 73 type: AST_TOKEN_TYPES.JSXText; 74} 75 76export interface KeywordToken extends BaseToken { 77 type: AST_TOKEN_TYPES.Keyword; 78} 79 80export interface NullToken extends BaseToken { 81 type: AST_TOKEN_TYPES.Null; 82} 83 84export interface NumericToken extends BaseToken { 85 type: AST_TOKEN_TYPES.Numeric; 86} 87 88export interface PunctuatorToken extends BaseToken { 89 type: AST_TOKEN_TYPES.Punctuator; 90} 91 92export interface RegularExpressionToken extends BaseToken { 93 type: AST_TOKEN_TYPES.RegularExpression; 94 regex: { 95 pattern: string; 96 flags: string; 97 }; 98} 99 100export interface StringToken extends BaseToken { 101 type: AST_TOKEN_TYPES.String; 102} 103 104export interface TemplateToken extends BaseToken { 105 type: AST_TOKEN_TYPES.Template; 106} 107 108export interface BlockComment extends BaseToken { 109 type: AST_TOKEN_TYPES.Block; 110} 111 112export interface LineComment extends BaseToken { 113 type: AST_TOKEN_TYPES.Line; 114} 115 116export type Comment = BlockComment | LineComment; 117export type Token = 118 | BooleanToken 119 | Comment 120 | IdentifierToken 121 | JSXIdentifierToken 122 | JSXTextToken 123 | KeywordToken 124 | NullToken 125 | NumericToken 126 | PunctuatorToken 127 | RegularExpressionToken 128 | StringToken 129 | TemplateToken; 130 131export type OptionalRangeAndLoc<T> = Pick< 132 T, 133 Exclude<keyof T, 'range' | 'loc'> 134> & { 135 range?: Range; 136 loc?: SourceLocation; 137}; 138 139// Every single valid AST Node 140// Please keep it sorted alphabetically. 141export type Node = 142 | ArrayExpression 143 | ArrayPattern 144 | ArrowFunctionExpression 145 | AssignmentExpression 146 | AssignmentPattern 147 | AwaitExpression 148 | BigIntLiteral 149 | BinaryExpression 150 | BlockStatement 151 | BreakStatement 152 | CallExpression 153 | CatchClause 154 | ChainExpression 155 | ClassBody 156 | ClassDeclaration 157 | ClassExpression 158 | ClassProperty 159 | ConditionalExpression 160 | ContinueStatement 161 | DebuggerStatement 162 | Decorator 163 | DoWhileStatement 164 | EmptyStatement 165 | ExportAllDeclaration 166 | ExportDefaultDeclaration 167 | ExportNamedDeclaration 168 | ExportSpecifier 169 | ExpressionStatement 170 | ForInStatement 171 | ForOfStatement 172 | ForStatement 173 | FunctionDeclaration 174 | FunctionExpression 175 | Identifier 176 | IfStatement 177 | ImportDeclaration 178 | ImportDefaultSpecifier 179 | ImportExpression 180 | ImportNamespaceSpecifier 181 | ImportSpecifier 182 | JSXAttribute 183 | JSXClosingElement 184 | JSXClosingFragment 185 | JSXElement 186 | JSXEmptyExpression 187 | JSXExpressionContainer 188 | JSXFragment 189 | JSXIdentifier 190 | JSXMemberExpression 191 | JSXOpeningElement 192 | JSXOpeningFragment 193 | JSXSpreadAttribute 194 | JSXSpreadChild 195 | JSXText 196 | LabeledStatement 197 | Literal 198 | LogicalExpression 199 | MemberExpression 200 | MetaProperty 201 | MethodDefinition 202 | NewExpression 203 | ObjectExpression 204 | ObjectPattern 205 | Program 206 | Property 207 | RestElement 208 | ReturnStatement 209 | SequenceExpression 210 | SpreadElement 211 | Super 212 | SwitchCase 213 | SwitchStatement 214 | TaggedTemplateExpression 215 | TemplateElement 216 | TemplateLiteral 217 | ThisExpression 218 | ThrowStatement 219 | TryStatement 220 | TSAbstractClassProperty 221 | TSAbstractKeyword 222 | TSAbstractMethodDefinition 223 | TSAnyKeyword 224 | TSArrayType 225 | TSAsExpression 226 | TSAsyncKeyword 227 | TSBigIntKeyword 228 | TSBooleanKeyword 229 | TSCallSignatureDeclaration 230 | TSClassImplements 231 | TSConditionalType 232 | TSConstructorType 233 | TSConstructSignatureDeclaration 234 | TSDeclareFunction 235 | TSDeclareKeyword 236 | TSEmptyBodyFunctionExpression 237 | TSEnumDeclaration 238 | TSEnumMember 239 | TSExportAssignment 240 | TSExportKeyword 241 | TSExternalModuleReference 242 | TSFunctionType 243 | TSImportEqualsDeclaration 244 | TSImportType 245 | TSIndexedAccessType 246 | TSIndexSignature 247 | TSInferType 248 | TSInterfaceBody 249 | TSInterfaceDeclaration 250 | TSInterfaceHeritage 251 | TSIntersectionType 252 | TSLiteralType 253 | TSMappedType 254 | TSMethodSignature 255 | TSModuleBlock 256 | TSModuleDeclaration 257 | TSNamedTupleMember 258 | TSNamespaceExportDeclaration 259 | TSNeverKeyword 260 | TSNonNullExpression 261 | TSNullKeyword 262 | TSNumberKeyword 263 | TSObjectKeyword 264 | TSOptionalType 265 | TSParameterProperty 266 | TSParenthesizedType 267 | TSPrivateKeyword 268 | TSPropertySignature 269 | TSProtectedKeyword 270 | TSPublicKeyword 271 | TSQualifiedName 272 | TSReadonlyKeyword 273 | TSRestType 274 | TSStaticKeyword 275 | TSStringKeyword 276 | TSSymbolKeyword 277 | TSTemplateLiteralType 278 | TSThisType 279 | TSTupleType 280 | TSTypeAliasDeclaration 281 | TSTypeAnnotation 282 | TSTypeAssertion 283 | TSTypeLiteral 284 | TSTypeOperator 285 | TSTypeParameter 286 | TSTypeParameterDeclaration 287 | TSTypeParameterInstantiation 288 | TSTypePredicate 289 | TSTypeQuery 290 | TSTypeReference 291 | TSUndefinedKeyword 292 | TSUnionType 293 | TSUnknownKeyword 294 | TSVoidKeyword 295 | UnaryExpression 296 | UpdateExpression 297 | VariableDeclaration 298 | VariableDeclarator 299 | WhileStatement 300 | WithStatement 301 | YieldExpression; 302 303////////// 304// Reusable Unions 305// These are based off of types used in the Typescript AST definitions 306// **Ensure you sort the union members alphabetically** 307////////// 308 309export type Accessibility = 'public' | 'protected' | 'private'; 310export type BindingPattern = ArrayPattern | ObjectPattern; 311export type BindingName = BindingPattern | Identifier; 312export type ChainElement = 313 | CallExpression 314 | MemberExpression 315 | TSNonNullExpression; 316export type ClassElement = 317 | ClassProperty 318 | MethodDefinition 319 | TSAbstractClassProperty 320 | TSAbstractMethodDefinition 321 | TSIndexSignature; 322export type ClassProperty = 323 | ClassPropertyComputedName 324 | ClassPropertyNonComputedName; 325export type DeclarationStatement = 326 | ClassDeclaration 327 | ClassExpression 328 | ExportDefaultDeclaration 329 | ExportAllDeclaration 330 | ExportNamedDeclaration 331 | FunctionDeclaration 332 | TSDeclareFunction 333 | TSImportEqualsDeclaration 334 | TSInterfaceDeclaration 335 | TSModuleDeclaration 336 | TSNamespaceExportDeclaration 337 | TSTypeAliasDeclaration 338 | TSEnumDeclaration; 339export type DestructuringPattern = 340 | Identifier 341 | ObjectPattern 342 | ArrayPattern 343 | RestElement 344 | AssignmentPattern 345 | MemberExpression; 346export type EntityName = Identifier | TSQualifiedName; 347export type ExportDeclaration = 348 | ClassDeclaration 349 | ClassExpression 350 | FunctionDeclaration 351 | TSDeclareFunction 352 | TSEnumDeclaration 353 | TSInterfaceDeclaration 354 | TSModuleDeclaration 355 | TSTypeAliasDeclaration 356 | VariableDeclaration; 357export type Expression = 358 | ArrowFunctionExpression 359 | AssignmentExpression 360 | BinaryExpression 361 | ChainExpression 362 | ConditionalExpression 363 | ImportExpression 364 | JSXClosingElement 365 | JSXClosingFragment 366 | JSXExpressionContainer 367 | JSXOpeningElement 368 | JSXOpeningFragment 369 | JSXSpreadChild 370 | LogicalExpression 371 | NewExpression 372 | RestElement 373 | SequenceExpression 374 | SpreadElement 375 | TSAsExpression 376 | TSUnaryExpression 377 | YieldExpression; 378export type ForInitialiser = Expression | VariableDeclaration; 379export type ImportClause = 380 | ImportDefaultSpecifier 381 | ImportNamespaceSpecifier 382 | ImportSpecifier; 383export type IterationStatement = 384 | DoWhileStatement 385 | ForInStatement 386 | ForOfStatement 387 | ForStatement 388 | WhileStatement; 389export type JSXChild = JSXElement | JSXExpression | JSXFragment | JSXText; 390export type JSXExpression = 391 | JSXEmptyExpression 392 | JSXSpreadChild 393 | JSXExpressionContainer; 394export type JSXTagNameExpression = JSXIdentifier | JSXMemberExpression; 395export type LeftHandSideExpression = 396 | CallExpression 397 | ClassExpression 398 | ClassDeclaration 399 | FunctionExpression 400 | LiteralExpression 401 | MemberExpression 402 | PrimaryExpression 403 | TaggedTemplateExpression 404 | TSNonNullExpression 405 | TSAsExpression 406 | ArrowFunctionExpression; 407export type Literal = 408 | BigIntLiteral 409 | BooleanLiteral 410 | NumberLiteral 411 | NullLiteral 412 | RegExpLiteral 413 | StringLiteral; 414export type LiteralExpression = Literal | TemplateLiteral; 415export type MemberExpression = 416 | MemberExpressionComputedName 417 | MemberExpressionNonComputedName; 418export type MethodDefinition = 419 | MethodDefinitionComputedName 420 | MethodDefinitionNonComputedName; 421export type Modifier = 422 | TSAbstractKeyword 423 | TSAsyncKeyword 424 | TSDeclareKeyword 425 | TSExportKeyword 426 | TSPublicKeyword 427 | TSPrivateKeyword 428 | TSProtectedKeyword 429 | TSReadonlyKeyword 430 | TSStaticKeyword; 431export type ObjectLiteralElementLike = 432 | MethodDefinition 433 | Property 434 | SpreadElement 435 | TSAbstractMethodDefinition; 436export type Parameter = 437 | ArrayPattern 438 | AssignmentPattern 439 | Identifier 440 | ObjectPattern 441 | RestElement 442 | TSParameterProperty; 443export type PrimaryExpression = 444 | ArrayExpression 445 | ArrayPattern 446 | ClassExpression 447 | FunctionExpression 448 | Identifier 449 | JSXElement 450 | JSXFragment 451 | JSXOpeningElement 452 | Literal 453 | LiteralExpression 454 | MetaProperty 455 | ObjectExpression 456 | ObjectPattern 457 | Super 458 | TemplateLiteral 459 | ThisExpression 460 | TSNullKeyword; 461export type ProgramStatement = 462 | ClassDeclaration 463 | ExportAllDeclaration 464 | ExportDefaultDeclaration 465 | ExportNamedDeclaration 466 | ImportDeclaration 467 | Statement 468 | TSDeclareFunction 469 | TSEnumDeclaration 470 | TSExportAssignment 471 | TSImportEqualsDeclaration 472 | TSInterfaceDeclaration 473 | TSNamespaceExportDeclaration 474 | TSTypeAliasDeclaration; 475export type Property = PropertyComputedName | PropertyNonComputedName; 476export type PropertyName = PropertyNameComputed | PropertyNameNonComputed; 477export type PropertyNameComputed = Expression; 478export type PropertyNameNonComputed = 479 | Identifier 480 | StringLiteral 481 | NumberLiteral; 482export type Statement = 483 | BlockStatement 484 | BreakStatement 485 | ContinueStatement 486 | DebuggerStatement 487 | DeclarationStatement 488 | EmptyStatement 489 | ExpressionStatement 490 | IfStatement 491 | IterationStatement 492 | ImportDeclaration 493 | LabeledStatement 494 | TSModuleBlock 495 | ReturnStatement 496 | SwitchStatement 497 | ThrowStatement 498 | TryStatement 499 | VariableDeclaration 500 | WithStatement; 501export type TSAbstractClassProperty = 502 | TSAbstractClassPropertyComputedName 503 | TSAbstractClassPropertyNonComputedName; 504export type TSAbstractMethodDefinition = 505 | TSAbstractMethodDefinitionComputedName 506 | TSAbstractMethodDefinitionNonComputedName; 507export type TSMethodSignature = 508 | TSMethodSignatureComputedName 509 | TSMethodSignatureNonComputedName; 510export type TSPropertySignature = 511 | TSPropertySignatureComputedName 512 | TSPropertySignatureNonComputedName; 513export type TSEnumMember = 514 | TSEnumMemberComputedName 515 | TSEnumMemberNonComputedName; 516export type TSUnaryExpression = 517 | AwaitExpression 518 | LeftHandSideExpression 519 | TSTypeAssertion 520 | UnaryExpression 521 | UpdateExpression; 522export type TypeElement = 523 | TSCallSignatureDeclaration 524 | TSConstructSignatureDeclaration 525 | TSIndexSignature 526 | TSMethodSignature 527 | TSPropertySignature; 528export type TypeNode = 529 | TSAnyKeyword 530 | TSArrayType 531 | TSBigIntKeyword 532 | TSBooleanKeyword 533 | TSConditionalType 534 | TSConstructorType 535 | TSFunctionType 536 | TSImportType 537 | TSIndexedAccessType 538 | TSInferType 539 | TSInterfaceHeritage 540 | TSIntersectionType 541 | TSLiteralType 542 | TSMappedType 543 | TSNamedTupleMember 544 | TSNeverKeyword 545 | TSNullKeyword 546 | TSNumberKeyword 547 | TSObjectKeyword 548 | TSOptionalType 549 | TSParenthesizedType 550 | TSRestType 551 | TSStringKeyword 552 | TSSymbolKeyword 553 | TSTemplateLiteralType 554 | TSThisType 555 | TSTupleType 556 | TSTypeLiteral 557 | TSTypeOperator 558 | TSTypePredicate 559 | TSTypeQuery 560 | TSTypeReference 561 | TSUndefinedKeyword 562 | TSUnionType 563 | TSUnknownKeyword 564 | TSVoidKeyword; 565 566/////////////// 567// Base, common types 568// **Ensure you sort the interfaces alphabetically** 569/////////////// 570 571interface BinaryExpressionBase extends BaseNode { 572 operator: string; 573 left: Expression; 574 right: Expression; 575} 576 577interface CallExpressionBase extends BaseNode { 578 callee: LeftHandSideExpression; 579 arguments: Expression[]; 580 typeParameters?: TSTypeParameterInstantiation; 581 optional: boolean; 582} 583 584interface ClassDeclarationBase extends BaseNode { 585 typeParameters?: TSTypeParameterDeclaration; 586 superTypeParameters?: TSTypeParameterInstantiation; 587 id: Identifier | null; 588 body: ClassBody; 589 superClass: LeftHandSideExpression | null; 590 implements?: TSClassImplements[]; 591 abstract?: boolean; 592 declare?: boolean; 593 decorators?: Decorator[]; 594} 595 596/** this should not be directly used - instead use ClassPropertyComputedNameBase or ClassPropertyNonComputedNameBase */ 597interface ClassPropertyBase extends BaseNode { 598 key: PropertyName; 599 value: Expression | null; 600 computed: boolean; 601 static: boolean; 602 declare: boolean; 603 readonly?: boolean; 604 decorators?: Decorator[]; 605 accessibility?: Accessibility; 606 optional?: boolean; 607 definite?: boolean; 608 typeAnnotation?: TSTypeAnnotation; 609} 610 611interface ClassPropertyComputedNameBase extends ClassPropertyBase { 612 key: PropertyNameComputed; 613 computed: true; 614} 615 616interface ClassPropertyNonComputedNameBase extends ClassPropertyBase { 617 key: PropertyNameNonComputed; 618 computed: false; 619} 620 621interface FunctionDeclarationBase extends BaseNode { 622 id: Identifier | null; 623 generator: boolean; 624 expression: boolean; 625 async: boolean; 626 params: Parameter[]; 627 body?: BlockStatement | null; 628 returnType?: TSTypeAnnotation; 629 typeParameters?: TSTypeParameterDeclaration; 630 declare?: boolean; 631} 632 633interface FunctionSignatureBase extends BaseNode { 634 params: Parameter[]; 635 returnType?: TSTypeAnnotation; 636 typeParameters?: TSTypeParameterDeclaration; 637} 638 639interface LiteralBase extends BaseNode { 640 raw: string; 641 value: string | boolean | null | number | RegExp | bigint; 642 regex?: { 643 pattern: string; 644 flags: string; 645 }; 646} 647 648/** this should not be directly used - instead use MemberExpressionComputedNameBase or MemberExpressionNonComputedNameBase */ 649interface MemberExpressionBase extends BaseNode { 650 object: LeftHandSideExpression; 651 property: Expression | Identifier; 652 computed: boolean; 653 optional: boolean; 654} 655 656interface MemberExpressionComputedNameBase extends MemberExpressionBase { 657 property: Expression; 658 computed: true; 659} 660 661interface MemberExpressionNonComputedNameBase extends MemberExpressionBase { 662 property: Identifier; 663 computed: false; 664} 665 666/** this should not be directly used - instead use MethodDefinitionComputedNameBase or MethodDefinitionNonComputedNameBase */ 667interface MethodDefinitionBase extends BaseNode { 668 key: PropertyName; 669 value: FunctionExpression | TSEmptyBodyFunctionExpression; 670 computed: boolean; 671 static: boolean; 672 kind: 'method' | 'get' | 'set' | 'constructor'; 673 optional?: boolean; 674 decorators?: Decorator[]; 675 accessibility?: Accessibility; 676 typeParameters?: TSTypeParameterDeclaration; 677} 678 679interface MethodDefinitionComputedNameBase extends MethodDefinitionBase { 680 key: PropertyNameComputed; 681 computed: true; 682} 683 684interface MethodDefinitionNonComputedNameBase extends MethodDefinitionBase { 685 key: PropertyNameNonComputed; 686 computed: false; 687} 688 689interface PropertyBase extends BaseNode { 690 type: AST_NODE_TYPES.Property; 691 key: PropertyName; 692 value: 693 | Expression 694 | AssignmentPattern 695 | BindingName 696 | TSEmptyBodyFunctionExpression; 697 computed: boolean; 698 method: boolean; 699 shorthand: boolean; 700 optional?: boolean; 701 kind: 'init' | 'get' | 'set'; 702} 703 704interface TSEnumMemberBase extends BaseNode { 705 type: AST_NODE_TYPES.TSEnumMember; 706 id: 707 | PropertyNameNonComputed 708 // this should only happen in semantically invalid code (ts error 1164) 709 | PropertyNameComputed; 710 initializer?: Expression; 711 computed?: boolean; 712} 713 714interface TSHeritageBase extends BaseNode { 715 expression: Expression; 716 typeParameters?: TSTypeParameterInstantiation; 717} 718 719interface TSMethodSignatureBase extends BaseNode { 720 type: AST_NODE_TYPES.TSMethodSignature; 721 key: PropertyName; 722 computed: boolean; 723 params: Parameter[]; 724 optional?: boolean; 725 returnType?: TSTypeAnnotation; 726 readonly?: boolean; 727 typeParameters?: TSTypeParameterDeclaration; 728 accessibility?: Accessibility; 729 export?: boolean; 730 static?: boolean; 731} 732 733interface TSPropertySignatureBase extends BaseNode { 734 type: AST_NODE_TYPES.TSPropertySignature; 735 key: PropertyName; 736 optional?: boolean; 737 computed: boolean; 738 typeAnnotation?: TSTypeAnnotation; 739 initializer?: Expression; 740 readonly?: boolean; 741 static?: boolean; 742 export?: boolean; 743 accessibility?: Accessibility; 744} 745 746interface UnaryExpressionBase extends BaseNode { 747 operator: string; 748 prefix: boolean; 749 argument: LeftHandSideExpression | Literal | UnaryExpression; 750} 751 752/////////////// 753// Typescript ESTree Nodes 754// **Ensure you sort the interfaces alphabetically** 755/////////////// 756 757export interface ArrayExpression extends BaseNode { 758 type: AST_NODE_TYPES.ArrayExpression; 759 elements: Expression[]; 760} 761 762export interface ArrayPattern extends BaseNode { 763 type: AST_NODE_TYPES.ArrayPattern; 764 elements: (DestructuringPattern | null)[]; 765 typeAnnotation?: TSTypeAnnotation; 766 optional?: boolean; 767 decorators?: Decorator[]; 768} 769 770export interface ArrowFunctionExpression extends BaseNode { 771 type: AST_NODE_TYPES.ArrowFunctionExpression; 772 generator: boolean; 773 id: null; 774 params: Parameter[]; 775 body: Expression | BlockStatement; 776 async: boolean; 777 expression: boolean; 778 returnType?: TSTypeAnnotation; 779 typeParameters?: TSTypeParameterDeclaration; 780} 781 782export interface AssignmentExpression extends BinaryExpressionBase { 783 type: AST_NODE_TYPES.AssignmentExpression; 784 operator: 785 | '-=' 786 | '??=' 787 | '**=' 788 | '*=' 789 | '/=' 790 | '&&=' 791 | '&=' 792 | '%=' 793 | '^=' 794 | '+=' 795 | '<<=' 796 | '=' 797 | '>>=' 798 | '>>>=' 799 | '|=' 800 | '||='; 801} 802 803export interface AssignmentPattern extends BaseNode { 804 type: AST_NODE_TYPES.AssignmentPattern; 805 left: BindingName; 806 right: Expression; 807 typeAnnotation?: TSTypeAnnotation; 808 optional?: boolean; 809 decorators?: Decorator[]; 810} 811 812export interface AwaitExpression extends BaseNode { 813 type: AST_NODE_TYPES.AwaitExpression; 814 argument: TSUnaryExpression; 815} 816 817export interface BigIntLiteral extends LiteralBase { 818 type: AST_NODE_TYPES.Literal; 819 value: bigint | null; 820 bigint: string; 821} 822 823export interface BinaryExpression extends BinaryExpressionBase { 824 type: AST_NODE_TYPES.BinaryExpression; 825} 826 827export interface BlockStatement extends BaseNode { 828 type: AST_NODE_TYPES.BlockStatement; 829 body: Statement[]; 830} 831 832export interface BooleanLiteral extends LiteralBase { 833 type: AST_NODE_TYPES.Literal; 834 value: boolean; 835} 836 837export interface BreakStatement extends BaseNode { 838 type: AST_NODE_TYPES.BreakStatement; 839 label: Identifier | null; 840} 841 842export interface ChainExpression extends BaseNode { 843 type: AST_NODE_TYPES.ChainExpression; 844 expression: ChainElement; 845} 846 847export interface CallExpression extends CallExpressionBase { 848 type: AST_NODE_TYPES.CallExpression; 849} 850 851export interface CatchClause extends BaseNode { 852 type: AST_NODE_TYPES.CatchClause; 853 param: BindingName | null; 854 body: BlockStatement; 855} 856 857export interface ClassBody extends BaseNode { 858 type: AST_NODE_TYPES.ClassBody; 859 body: ClassElement[]; 860} 861 862export interface ClassDeclaration extends ClassDeclarationBase { 863 type: AST_NODE_TYPES.ClassDeclaration; 864} 865 866export interface ClassExpression extends ClassDeclarationBase { 867 type: AST_NODE_TYPES.ClassExpression; 868} 869 870export interface ClassPropertyComputedName 871 extends ClassPropertyComputedNameBase { 872 type: AST_NODE_TYPES.ClassProperty; 873} 874 875export interface ClassPropertyNonComputedName 876 extends ClassPropertyNonComputedNameBase { 877 type: AST_NODE_TYPES.ClassProperty; 878} 879 880export interface ConditionalExpression extends BaseNode { 881 type: AST_NODE_TYPES.ConditionalExpression; 882 test: Expression; 883 consequent: Expression; 884 alternate: Expression; 885} 886 887export interface ContinueStatement extends BaseNode { 888 type: AST_NODE_TYPES.ContinueStatement; 889 label: Identifier | null; 890} 891 892export interface DebuggerStatement extends BaseNode { 893 type: AST_NODE_TYPES.DebuggerStatement; 894} 895 896export interface Decorator extends BaseNode { 897 type: AST_NODE_TYPES.Decorator; 898 expression: LeftHandSideExpression; 899} 900 901export interface DoWhileStatement extends BaseNode { 902 type: AST_NODE_TYPES.DoWhileStatement; 903 test: Expression; 904 body: Statement; 905} 906 907export interface EmptyStatement extends BaseNode { 908 type: AST_NODE_TYPES.EmptyStatement; 909} 910 911export interface ExportAllDeclaration extends BaseNode { 912 type: AST_NODE_TYPES.ExportAllDeclaration; 913 source: Expression | null; 914 exportKind: 'type' | 'value'; 915 exported: Identifier | null; 916} 917 918export interface ExportDefaultDeclaration extends BaseNode { 919 type: AST_NODE_TYPES.ExportDefaultDeclaration; 920 declaration: ExportDeclaration | Expression; 921 exportKind: 'type' | 'value'; 922} 923 924export interface ExportNamedDeclaration extends BaseNode { 925 type: AST_NODE_TYPES.ExportNamedDeclaration; 926 declaration: ExportDeclaration | null; 927 specifiers: ExportSpecifier[]; 928 source: Expression | null; 929 exportKind: 'type' | 'value'; 930} 931 932export interface ExportSpecifier extends BaseNode { 933 type: AST_NODE_TYPES.ExportSpecifier; 934 local: Identifier; 935 exported: Identifier; 936} 937 938export interface ExpressionStatement extends BaseNode { 939 type: AST_NODE_TYPES.ExpressionStatement; 940 expression: Expression; 941 directive?: string; 942} 943 944export interface ForInStatement extends BaseNode { 945 type: AST_NODE_TYPES.ForInStatement; 946 left: ForInitialiser; 947 right: Expression; 948 body: Statement; 949} 950 951export interface ForOfStatement extends BaseNode { 952 type: AST_NODE_TYPES.ForOfStatement; 953 left: ForInitialiser; 954 right: Expression; 955 body: Statement; 956 await: boolean; 957} 958 959export interface ForStatement extends BaseNode { 960 type: AST_NODE_TYPES.ForStatement; 961 init: Expression | ForInitialiser | null; 962 test: Expression | null; 963 update: Expression | null; 964 body: Statement; 965} 966 967export interface FunctionDeclaration extends FunctionDeclarationBase { 968 type: AST_NODE_TYPES.FunctionDeclaration; 969 body: BlockStatement; 970} 971 972export interface FunctionExpression extends FunctionDeclarationBase { 973 type: AST_NODE_TYPES.FunctionExpression; 974 body: BlockStatement; 975} 976 977export interface Identifier extends BaseNode { 978 type: AST_NODE_TYPES.Identifier; 979 name: string; 980 typeAnnotation?: TSTypeAnnotation; 981 optional?: boolean; 982 decorators?: Decorator[]; 983} 984 985export interface IfStatement extends BaseNode { 986 type: AST_NODE_TYPES.IfStatement; 987 test: Expression; 988 consequent: Statement; 989 alternate: Statement | null; 990} 991 992export interface ImportDeclaration extends BaseNode { 993 type: AST_NODE_TYPES.ImportDeclaration; 994 source: Literal; 995 specifiers: ImportClause[]; 996 importKind: 'type' | 'value'; 997} 998 999export interface ImportDefaultSpecifier extends BaseNode { 1000 type: AST_NODE_TYPES.ImportDefaultSpecifier; 1001 local: Identifier; 1002} 1003 1004export interface ImportExpression extends BaseNode { 1005 type: AST_NODE_TYPES.ImportExpression; 1006 source: Expression; 1007} 1008 1009export interface ImportNamespaceSpecifier extends BaseNode { 1010 type: AST_NODE_TYPES.ImportNamespaceSpecifier; 1011 local: Identifier; 1012} 1013 1014export interface ImportSpecifier extends BaseNode { 1015 type: AST_NODE_TYPES.ImportSpecifier; 1016 local: Identifier; 1017 imported: Identifier; 1018} 1019 1020export interface JSXAttribute extends BaseNode { 1021 type: AST_NODE_TYPES.JSXAttribute; 1022 name: JSXIdentifier; 1023 value: Literal | JSXExpression | null; 1024} 1025 1026export interface JSXClosingElement extends BaseNode { 1027 type: AST_NODE_TYPES.JSXClosingElement; 1028 name: JSXTagNameExpression; 1029} 1030 1031export interface JSXClosingFragment extends BaseNode { 1032 type: AST_NODE_TYPES.JSXClosingFragment; 1033} 1034 1035export interface JSXElement extends BaseNode { 1036 type: AST_NODE_TYPES.JSXElement; 1037 openingElement: JSXOpeningElement; 1038 closingElement: JSXClosingElement | null; 1039 children: JSXChild[]; 1040} 1041 1042export interface JSXEmptyExpression extends BaseNode { 1043 type: AST_NODE_TYPES.JSXEmptyExpression; 1044} 1045 1046export interface JSXExpressionContainer extends BaseNode { 1047 type: AST_NODE_TYPES.JSXExpressionContainer; 1048 expression: Expression | JSXEmptyExpression; 1049} 1050 1051export interface JSXFragment extends BaseNode { 1052 type: AST_NODE_TYPES.JSXFragment; 1053 openingFragment: JSXOpeningFragment; 1054 closingFragment: JSXClosingFragment; 1055 children: JSXChild[]; 1056} 1057 1058export interface JSXIdentifier extends BaseNode { 1059 type: AST_NODE_TYPES.JSXIdentifier; 1060 name: string; 1061} 1062 1063export interface JSXMemberExpression extends BaseNode { 1064 type: AST_NODE_TYPES.JSXMemberExpression; 1065 object: JSXTagNameExpression; 1066 property: JSXIdentifier; 1067} 1068 1069export interface JSXOpeningElement extends BaseNode { 1070 type: AST_NODE_TYPES.JSXOpeningElement; 1071 typeParameters?: TSTypeParameterInstantiation; 1072 selfClosing: boolean; 1073 name: JSXTagNameExpression; 1074 attributes: JSXAttribute[]; 1075} 1076 1077export interface JSXOpeningFragment extends BaseNode { 1078 type: AST_NODE_TYPES.JSXOpeningFragment; 1079} 1080 1081export interface JSXSpreadAttribute extends BaseNode { 1082 type: AST_NODE_TYPES.JSXSpreadAttribute; 1083 argument: Expression; 1084} 1085 1086export interface JSXSpreadChild extends BaseNode { 1087 type: AST_NODE_TYPES.JSXSpreadChild; 1088 expression: Expression | JSXEmptyExpression; 1089} 1090 1091export interface JSXText extends BaseNode { 1092 type: AST_NODE_TYPES.JSXText; 1093 value: string; 1094 raw: string; 1095} 1096 1097export interface LabeledStatement extends BaseNode { 1098 type: AST_NODE_TYPES.LabeledStatement; 1099 label: Identifier; 1100 body: Statement; 1101} 1102 1103export interface LogicalExpression extends BinaryExpressionBase { 1104 type: AST_NODE_TYPES.LogicalExpression; 1105} 1106 1107export interface MemberExpressionComputedName 1108 extends MemberExpressionComputedNameBase { 1109 type: AST_NODE_TYPES.MemberExpression; 1110} 1111 1112export interface MemberExpressionNonComputedName 1113 extends MemberExpressionNonComputedNameBase { 1114 type: AST_NODE_TYPES.MemberExpression; 1115} 1116 1117export interface MetaProperty extends BaseNode { 1118 type: AST_NODE_TYPES.MetaProperty; 1119 meta: Identifier; 1120 property: Identifier; 1121} 1122 1123export interface MethodDefinitionComputedName 1124 extends MethodDefinitionComputedNameBase { 1125 type: AST_NODE_TYPES.MethodDefinition; 1126} 1127 1128export interface MethodDefinitionNonComputedName 1129 extends MethodDefinitionNonComputedNameBase { 1130 type: AST_NODE_TYPES.MethodDefinition; 1131} 1132 1133export interface NewExpression extends BaseNode { 1134 type: AST_NODE_TYPES.NewExpression; 1135 callee: LeftHandSideExpression; 1136 arguments: Expression[]; 1137 typeParameters?: TSTypeParameterInstantiation; 1138} 1139 1140export interface NumberLiteral extends LiteralBase { 1141 type: AST_NODE_TYPES.Literal; 1142 value: number; 1143} 1144 1145export interface NullLiteral extends LiteralBase { 1146 type: AST_NODE_TYPES.Literal; 1147 value: null; 1148} 1149 1150export interface ObjectExpression extends BaseNode { 1151 type: AST_NODE_TYPES.ObjectExpression; 1152 properties: ObjectLiteralElementLike[]; 1153} 1154 1155export interface ObjectPattern extends BaseNode { 1156 type: AST_NODE_TYPES.ObjectPattern; 1157 properties: (Property | RestElement)[]; 1158 typeAnnotation?: TSTypeAnnotation; 1159 optional?: boolean; 1160 decorators?: Decorator[]; 1161} 1162 1163export interface Program extends BaseNode { 1164 type: AST_NODE_TYPES.Program; 1165 body: ProgramStatement[]; 1166 sourceType: 'module' | 'script'; 1167 comments?: Comment[]; 1168 tokens?: Token[]; 1169} 1170 1171export interface PropertyComputedName extends PropertyBase { 1172 key: PropertyNameComputed; 1173 computed: true; 1174} 1175 1176export interface PropertyNonComputedName extends PropertyBase { 1177 key: PropertyNameNonComputed; 1178 computed: false; 1179} 1180 1181export interface RegExpLiteral extends LiteralBase { 1182 type: AST_NODE_TYPES.Literal; 1183 value: RegExp; 1184} 1185 1186export interface RestElement extends BaseNode { 1187 type: AST_NODE_TYPES.RestElement; 1188 argument: DestructuringPattern; 1189 typeAnnotation?: TSTypeAnnotation; 1190 optional?: boolean; 1191 value?: AssignmentPattern; 1192 decorators?: Decorator[]; 1193} 1194 1195export interface ReturnStatement extends BaseNode { 1196 type: AST_NODE_TYPES.ReturnStatement; 1197 argument: Expression | null; 1198} 1199 1200export interface SequenceExpression extends BaseNode { 1201 type: AST_NODE_TYPES.SequenceExpression; 1202 expressions: Expression[]; 1203} 1204 1205export interface SpreadElement extends BaseNode { 1206 type: AST_NODE_TYPES.SpreadElement; 1207 argument: Expression; 1208} 1209 1210export interface StringLiteral extends LiteralBase { 1211 type: AST_NODE_TYPES.Literal; 1212 value: string; 1213} 1214 1215export interface Super extends BaseNode { 1216 type: AST_NODE_TYPES.Super; 1217} 1218 1219export interface SwitchCase extends BaseNode { 1220 type: AST_NODE_TYPES.SwitchCase; 1221 test: Expression | null; 1222 consequent: Statement[]; 1223} 1224 1225export interface SwitchStatement extends BaseNode { 1226 type: AST_NODE_TYPES.SwitchStatement; 1227 discriminant: Expression; 1228 cases: SwitchCase[]; 1229} 1230 1231export interface TaggedTemplateExpression extends BaseNode { 1232 type: AST_NODE_TYPES.TaggedTemplateExpression; 1233 typeParameters?: TSTypeParameterInstantiation; 1234 tag: LeftHandSideExpression; 1235 quasi: TemplateLiteral; 1236} 1237 1238export interface TemplateElement extends BaseNode { 1239 type: AST_NODE_TYPES.TemplateElement; 1240 value: { 1241 raw: string; 1242 cooked: string; 1243 }; 1244 tail: boolean; 1245} 1246 1247export interface TemplateLiteral extends BaseNode { 1248 type: AST_NODE_TYPES.TemplateLiteral; 1249 quasis: TemplateElement[]; 1250 expressions: Expression[]; 1251} 1252 1253export interface ThisExpression extends BaseNode { 1254 type: AST_NODE_TYPES.ThisExpression; 1255} 1256 1257export interface ThrowStatement extends BaseNode { 1258 type: AST_NODE_TYPES.ThrowStatement; 1259 argument: Statement | TSAsExpression | null; 1260} 1261 1262export interface TryStatement extends BaseNode { 1263 type: AST_NODE_TYPES.TryStatement; 1264 block: BlockStatement; 1265 handler: CatchClause | null; 1266 finalizer: BlockStatement; 1267} 1268 1269export interface TSAbstractClassPropertyComputedName 1270 extends ClassPropertyComputedNameBase { 1271 type: AST_NODE_TYPES.TSAbstractClassProperty; 1272} 1273 1274export interface TSAbstractClassPropertyNonComputedName 1275 extends ClassPropertyNonComputedNameBase { 1276 type: AST_NODE_TYPES.TSAbstractClassProperty; 1277} 1278 1279export interface TSAbstractKeyword extends BaseNode { 1280 type: AST_NODE_TYPES.TSAbstractKeyword; 1281} 1282 1283export interface TSAbstractMethodDefinitionComputedName 1284 extends MethodDefinitionComputedNameBase { 1285 type: AST_NODE_TYPES.TSAbstractMethodDefinition; 1286} 1287 1288export interface TSAbstractMethodDefinitionNonComputedName 1289 extends MethodDefinitionNonComputedNameBase { 1290 type: AST_NODE_TYPES.TSAbstractMethodDefinition; 1291} 1292 1293export interface TSAnyKeyword extends BaseNode { 1294 type: AST_NODE_TYPES.TSAnyKeyword; 1295} 1296 1297export interface TSArrayType extends BaseNode { 1298 type: AST_NODE_TYPES.TSArrayType; 1299 elementType: TypeNode; 1300} 1301 1302export interface TSAsExpression extends BaseNode { 1303 type: AST_NODE_TYPES.TSAsExpression; 1304 expression: Expression; 1305 typeAnnotation: TypeNode; 1306} 1307 1308export interface TSAsyncKeyword extends BaseNode { 1309 type: AST_NODE_TYPES.TSAsyncKeyword; 1310} 1311 1312export interface TSBigIntKeyword extends BaseNode { 1313 type: AST_NODE_TYPES.TSBigIntKeyword; 1314} 1315 1316export interface TSBooleanKeyword extends BaseNode { 1317 type: AST_NODE_TYPES.TSBooleanKeyword; 1318} 1319 1320export interface TSCallSignatureDeclaration extends FunctionSignatureBase { 1321 type: AST_NODE_TYPES.TSCallSignatureDeclaration; 1322} 1323 1324export interface TSClassImplements extends TSHeritageBase { 1325 type: AST_NODE_TYPES.TSClassImplements; 1326} 1327 1328export interface TSConditionalType extends BaseNode { 1329 type: AST_NODE_TYPES.TSConditionalType; 1330 checkType: TypeNode; 1331 extendsType: TypeNode; 1332 trueType: TypeNode; 1333 falseType: TypeNode; 1334} 1335 1336export interface TSConstructorType extends FunctionSignatureBase { 1337 type: AST_NODE_TYPES.TSConstructorType; 1338} 1339 1340export interface TSConstructSignatureDeclaration extends FunctionSignatureBase { 1341 type: AST_NODE_TYPES.TSConstructSignatureDeclaration; 1342} 1343 1344export interface TSDeclareFunction extends FunctionDeclarationBase { 1345 type: AST_NODE_TYPES.TSDeclareFunction; 1346} 1347 1348export interface TSDeclareKeyword extends BaseNode { 1349 type: AST_NODE_TYPES.TSDeclareKeyword; 1350} 1351 1352export interface TSEmptyBodyFunctionExpression extends FunctionDeclarationBase { 1353 type: AST_NODE_TYPES.TSEmptyBodyFunctionExpression; 1354 body: null; 1355} 1356 1357export interface TSEnumDeclaration extends BaseNode { 1358 type: AST_NODE_TYPES.TSEnumDeclaration; 1359 id: Identifier; 1360 members: TSEnumMember[]; 1361 const?: boolean; 1362 declare?: boolean; 1363 modifiers?: Modifier[]; 1364} 1365 1366/** 1367 * this should only really happen in semantically invalid code (errors 1164 and 2452) 1368 * 1369 * VALID: 1370 * enum Foo { ['a'] } 1371 * 1372 * INVALID: 1373 * const x = 'a'; 1374 * enum Foo { [x] } 1375 * enum Bar { ['a' + 'b'] } 1376 */ 1377export interface TSEnumMemberComputedName extends TSEnumMemberBase { 1378 id: PropertyNameComputed; 1379 computed: true; 1380} 1381 1382export interface TSEnumMemberNonComputedName extends TSEnumMemberBase { 1383 id: PropertyNameNonComputed; 1384 computed?: false; 1385} 1386 1387export interface TSExportAssignment extends BaseNode { 1388 type: AST_NODE_TYPES.TSExportAssignment; 1389 expression: Expression; 1390} 1391 1392export interface TSExportKeyword extends BaseNode { 1393 type: AST_NODE_TYPES.TSExportKeyword; 1394} 1395 1396export interface TSExternalModuleReference extends BaseNode { 1397 type: AST_NODE_TYPES.TSExternalModuleReference; 1398 expression: Expression; 1399} 1400 1401export interface TSFunctionType extends FunctionSignatureBase { 1402 type: AST_NODE_TYPES.TSFunctionType; 1403} 1404 1405export interface TSImportEqualsDeclaration extends BaseNode { 1406 type: AST_NODE_TYPES.TSImportEqualsDeclaration; 1407 id: Identifier; 1408 moduleReference: EntityName | TSExternalModuleReference; 1409 isExport: boolean; 1410} 1411 1412export interface TSImportType extends BaseNode { 1413 type: AST_NODE_TYPES.TSImportType; 1414 isTypeOf: boolean; 1415 parameter: TypeNode; 1416 qualifier: EntityName | null; 1417 typeParameters: TSTypeParameterInstantiation | null; 1418} 1419 1420export interface TSIndexedAccessType extends BaseNode { 1421 type: AST_NODE_TYPES.TSIndexedAccessType; 1422 objectType: TypeNode; 1423 indexType: TypeNode; 1424} 1425 1426export interface TSIndexSignature extends BaseNode { 1427 type: AST_NODE_TYPES.TSIndexSignature; 1428 parameters: Parameter[]; 1429 typeAnnotation?: TSTypeAnnotation; 1430 readonly?: boolean; 1431 accessibility?: Accessibility; 1432 export?: boolean; 1433 static?: boolean; 1434} 1435 1436export interface TSInferType extends BaseNode { 1437 type: AST_NODE_TYPES.TSInferType; 1438 typeParameter: TSTypeParameter; 1439} 1440 1441export interface TSInterfaceDeclaration extends BaseNode { 1442 type: AST_NODE_TYPES.TSInterfaceDeclaration; 1443 body: TSInterfaceBody; 1444 id: Identifier; 1445 typeParameters?: TSTypeParameterDeclaration; 1446 extends?: TSInterfaceHeritage[]; 1447 implements?: TSInterfaceHeritage[]; 1448 abstract?: boolean; 1449 declare?: boolean; 1450} 1451 1452export interface TSInterfaceBody extends BaseNode { 1453 type: AST_NODE_TYPES.TSInterfaceBody; 1454 body: TypeElement[]; 1455} 1456 1457export interface TSInterfaceHeritage extends TSHeritageBase { 1458 type: AST_NODE_TYPES.TSInterfaceHeritage; 1459} 1460 1461export interface TSIntersectionType extends BaseNode { 1462 type: AST_NODE_TYPES.TSIntersectionType; 1463 types: TypeNode[]; 1464} 1465 1466export interface TSLiteralType extends BaseNode { 1467 type: AST_NODE_TYPES.TSLiteralType; 1468 literal: LiteralExpression | UnaryExpression | UpdateExpression; 1469} 1470 1471export interface TSMappedType extends BaseNode { 1472 type: AST_NODE_TYPES.TSMappedType; 1473 typeParameter: TSTypeParameter; 1474 readonly?: boolean | '-' | '+'; 1475 optional?: boolean | '-' | '+'; 1476 typeAnnotation?: TypeNode; 1477 nameType: TypeNode | null; 1478} 1479 1480export interface TSMethodSignatureComputedName extends TSMethodSignatureBase { 1481 key: PropertyNameComputed; 1482 computed: true; 1483} 1484 1485export interface TSMethodSignatureNonComputedName 1486 extends TSMethodSignatureBase { 1487 key: PropertyNameNonComputed; 1488 computed: false; 1489} 1490 1491export interface TSModuleBlock extends BaseNode { 1492 type: AST_NODE_TYPES.TSModuleBlock; 1493 body: ProgramStatement[]; 1494} 1495 1496export interface TSModuleDeclaration extends BaseNode { 1497 type: AST_NODE_TYPES.TSModuleDeclaration; 1498 id: Identifier | Literal; 1499 body?: TSModuleBlock; 1500 global?: boolean; 1501 declare?: boolean; 1502 modifiers?: Modifier[]; 1503} 1504 1505export interface TSNamedTupleMember extends BaseNode { 1506 type: AST_NODE_TYPES.TSNamedTupleMember; 1507 elementType: TypeNode; 1508 label: Identifier; 1509 optional: boolean; 1510} 1511 1512export interface TSNamespaceExportDeclaration extends BaseNode { 1513 type: AST_NODE_TYPES.TSNamespaceExportDeclaration; 1514 id: Identifier; 1515} 1516 1517export interface TSNeverKeyword extends BaseNode { 1518 type: AST_NODE_TYPES.TSNeverKeyword; 1519} 1520 1521export interface TSNonNullExpression extends BaseNode { 1522 type: AST_NODE_TYPES.TSNonNullExpression; 1523 expression: Expression; 1524} 1525 1526export interface TSNullKeyword extends BaseNode { 1527 type: AST_NODE_TYPES.TSNullKeyword; 1528} 1529 1530export interface TSNumberKeyword extends BaseNode { 1531 type: AST_NODE_TYPES.TSNumberKeyword; 1532} 1533 1534export interface TSObjectKeyword extends BaseNode { 1535 type: AST_NODE_TYPES.TSObjectKeyword; 1536} 1537 1538export interface TSOptionalType extends BaseNode { 1539 type: AST_NODE_TYPES.TSOptionalType; 1540 typeAnnotation: TypeNode; 1541} 1542 1543export interface TSParameterProperty extends BaseNode { 1544 type: AST_NODE_TYPES.TSParameterProperty; 1545 accessibility?: Accessibility; 1546 readonly?: boolean; 1547 static?: boolean; 1548 export?: boolean; 1549 parameter: AssignmentPattern | BindingName | RestElement; 1550 decorators?: Decorator[]; 1551} 1552 1553export interface TSParenthesizedType extends BaseNode { 1554 type: AST_NODE_TYPES.TSParenthesizedType; 1555 typeAnnotation: TypeNode; 1556} 1557 1558export interface TSPropertySignatureComputedName 1559 extends TSPropertySignatureBase { 1560 key: PropertyNameComputed; 1561 computed: true; 1562} 1563 1564export interface TSPropertySignatureNonComputedName 1565 extends TSPropertySignatureBase { 1566 key: PropertyNameNonComputed; 1567 computed: false; 1568} 1569 1570export interface TSPublicKeyword extends BaseNode { 1571 type: AST_NODE_TYPES.TSPublicKeyword; 1572} 1573 1574export interface TSPrivateKeyword extends BaseNode { 1575 type: AST_NODE_TYPES.TSPrivateKeyword; 1576} 1577 1578export interface TSProtectedKeyword extends BaseNode { 1579 type: AST_NODE_TYPES.TSProtectedKeyword; 1580} 1581 1582export interface TSQualifiedName extends BaseNode { 1583 type: AST_NODE_TYPES.TSQualifiedName; 1584 left: EntityName; 1585 right: Identifier; 1586} 1587 1588export interface TSReadonlyKeyword extends BaseNode { 1589 type: AST_NODE_TYPES.TSReadonlyKeyword; 1590} 1591 1592export interface TSRestType extends BaseNode { 1593 type: AST_NODE_TYPES.TSRestType; 1594 typeAnnotation: TypeNode; 1595} 1596 1597export interface TSStaticKeyword extends BaseNode { 1598 type: AST_NODE_TYPES.TSStaticKeyword; 1599} 1600 1601export interface TSStringKeyword extends BaseNode { 1602 type: AST_NODE_TYPES.TSStringKeyword; 1603} 1604 1605export interface TSSymbolKeyword extends BaseNode { 1606 type: AST_NODE_TYPES.TSSymbolKeyword; 1607} 1608 1609export interface TSTemplateLiteralType extends BaseNode { 1610 type: AST_NODE_TYPES.TSTemplateLiteralType; 1611 quasis: TemplateElement[]; 1612 types: TypeNode[]; 1613} 1614 1615export interface TSThisType extends BaseNode { 1616 type: AST_NODE_TYPES.TSThisType; 1617} 1618 1619export interface TSTupleType extends BaseNode { 1620 type: AST_NODE_TYPES.TSTupleType; 1621 elementTypes: TypeNode[]; 1622} 1623 1624export interface TSTypeAliasDeclaration extends BaseNode { 1625 type: AST_NODE_TYPES.TSTypeAliasDeclaration; 1626 id: Identifier; 1627 typeAnnotation: TypeNode; 1628 declare?: boolean; 1629 typeParameters?: TSTypeParameterDeclaration; 1630} 1631 1632export interface TSTypeAnnotation extends BaseNode { 1633 type: AST_NODE_TYPES.TSTypeAnnotation; 1634 typeAnnotation: TypeNode; 1635} 1636 1637export interface TSTypeAssertion extends BaseNode { 1638 type: AST_NODE_TYPES.TSTypeAssertion; 1639 typeAnnotation: TypeNode; 1640 expression: Expression; 1641} 1642 1643export interface TSTypeLiteral extends BaseNode { 1644 type: AST_NODE_TYPES.TSTypeLiteral; 1645 members: TypeElement[]; 1646} 1647 1648export interface TSTypeOperator extends BaseNode { 1649 type: AST_NODE_TYPES.TSTypeOperator; 1650 operator: 'keyof' | 'unique' | 'readonly'; 1651 typeAnnotation?: TypeNode; 1652} 1653 1654export interface TSTypeParameter extends BaseNode { 1655 type: AST_NODE_TYPES.TSTypeParameter; 1656 name: Identifier; 1657 constraint?: TypeNode; 1658 default?: TypeNode; 1659} 1660 1661export interface TSTypeParameterDeclaration extends BaseNode { 1662 type: AST_NODE_TYPES.TSTypeParameterDeclaration; 1663 params: TSTypeParameter[]; 1664} 1665 1666export interface TSTypeParameterInstantiation extends BaseNode { 1667 type: AST_NODE_TYPES.TSTypeParameterInstantiation; 1668 params: TypeNode[]; 1669} 1670 1671export interface TSTypePredicate extends BaseNode { 1672 type: AST_NODE_TYPES.TSTypePredicate; 1673 asserts: boolean; 1674 parameterName: Identifier | TSThisType; 1675 typeAnnotation: TSTypeAnnotation | null; 1676} 1677 1678export interface TSTypeQuery extends BaseNode { 1679 type: AST_NODE_TYPES.TSTypeQuery; 1680 exprName: EntityName; 1681} 1682 1683export interface TSTypeReference extends BaseNode { 1684 type: AST_NODE_TYPES.TSTypeReference; 1685 typeName: EntityName; 1686 typeParameters?: TSTypeParameterInstantiation; 1687} 1688 1689export interface TSUndefinedKeyword extends BaseNode { 1690 type: AST_NODE_TYPES.TSUndefinedKeyword; 1691} 1692 1693export interface TSUnionType extends BaseNode { 1694 type: AST_NODE_TYPES.TSUnionType; 1695 types: TypeNode[]; 1696} 1697 1698export interface TSUnknownKeyword extends BaseNode { 1699 type: AST_NODE_TYPES.TSUnknownKeyword; 1700} 1701 1702export interface TSVoidKeyword extends BaseNode { 1703 type: AST_NODE_TYPES.TSVoidKeyword; 1704} 1705 1706export interface UpdateExpression extends UnaryExpressionBase { 1707 type: AST_NODE_TYPES.UpdateExpression; 1708 operator: '++' | '--'; 1709} 1710 1711export interface UnaryExpression extends UnaryExpressionBase { 1712 type: AST_NODE_TYPES.UnaryExpression; 1713 operator: '+' | '-' | '!' | '~' | 'delete' | 'void' | 'typeof'; 1714} 1715 1716export interface VariableDeclaration extends BaseNode { 1717 type: AST_NODE_TYPES.VariableDeclaration; 1718 // NOTE - this is not guaranteed to have any elements in it. i.e. `const;` 1719 declarations: VariableDeclarator[]; 1720 kind: 'let' | 'const' | 'var'; 1721 declare?: boolean; 1722} 1723 1724export interface VariableDeclarator extends BaseNode { 1725 type: AST_NODE_TYPES.VariableDeclarator; 1726 id: BindingName; 1727 init: Expression | null; 1728 definite?: boolean; 1729} 1730 1731export interface WhileStatement extends BaseNode { 1732 type: AST_NODE_TYPES.WhileStatement; 1733 test: Expression; 1734 body: Statement; 1735} 1736 1737export interface WithStatement extends BaseNode { 1738 type: AST_NODE_TYPES.WithStatement; 1739 object: Expression; 1740 body: Statement; 1741} 1742 1743export interface YieldExpression extends BaseNode { 1744 type: AST_NODE_TYPES.YieldExpression; 1745 delegate: boolean; 1746 argument?: Expression; 1747} 1748