1import { AST_NODE_TYPES, AST_TOKEN_TYPES } from './ast-node-types'; 2export interface LineAndColumnData { 3 /** 4 * Line number (1-indexed) 5 */ 6 line: number; 7 /** 8 * Column number on the line (0-indexed) 9 */ 10 column: number; 11} 12export interface SourceLocation { 13 /** 14 * The position of the first character of the parsed source region 15 */ 16 start: LineAndColumnData; 17 /** 18 * The position of the first character after the parsed source region 19 */ 20 end: LineAndColumnData; 21} 22export declare type Range = [number, number]; 23export interface BaseNode { 24 /** 25 * The source location information of the node. 26 */ 27 loc: SourceLocation; 28 /** 29 * An array of two numbers. 30 * Both numbers are a 0-based index which is the position in the array of source code characters. 31 * The first is the start position of the node, the second is the end position of the node. 32 */ 33 range: Range; 34 /** 35 * The parent node of the current node 36 */ 37 parent?: Node; 38} 39export interface Token extends BaseNode { 40 type: AST_TOKEN_TYPES; 41 value: string; 42 regex?: { 43 pattern: string; 44 flags: string; 45 }; 46} 47export interface Comment extends BaseNode { 48 type: 'Line' | 'Block'; 49 value: string; 50} 51export declare type OptionalRangeAndLoc<T> = Pick<T, Exclude<keyof T, 'range' | 'loc'>> & { 52 range?: Range; 53 loc?: SourceLocation; 54}; 55export 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 | Import | ImportDeclaration | ImportDefaultSpecifier | 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; 56export declare type Accessibility = 'public' | 'protected' | 'private'; 57export declare type BindingPattern = ArrayPattern | ObjectPattern; 58export declare type BindingName = BindingPattern | Identifier; 59export declare type ClassElement = ClassProperty | FunctionExpression | MethodDefinition | TSAbstractClassProperty | TSAbstractMethodDefinition | TSEmptyBodyFunctionExpression | TSIndexSignature; 60export declare type ClassProperty = ClassPropertyComputedName | ClassPropertyNonComputedName; 61export declare type DeclarationStatement = ClassDeclaration | ClassExpression | ExportDefaultDeclaration | ExportAllDeclaration | ExportNamedDeclaration | FunctionDeclaration | TSDeclareFunction | TSImportEqualsDeclaration | TSInterfaceDeclaration | TSModuleDeclaration | TSNamespaceExportDeclaration | TSTypeAliasDeclaration | TSEnumDeclaration; 62export declare type EntityName = Identifier | TSQualifiedName; 63export declare type ExportDeclaration = ClassDeclaration | ClassExpression | FunctionDeclaration | TSDeclareFunction | TSEnumDeclaration | TSInterfaceDeclaration | TSModuleDeclaration | TSTypeAliasDeclaration | VariableDeclaration; 64export declare type Expression = ArrowFunctionExpression | AssignmentExpression | BinaryExpression | ConditionalExpression | JSXClosingElement | JSXClosingFragment | JSXExpressionContainer | JSXOpeningElement | JSXOpeningFragment | JSXSpreadChild | LogicalExpression | NewExpression | RestElement | SequenceExpression | SpreadElement | TSAsExpression | TSUnaryExpression | YieldExpression; 65export declare type ExpressionWithTypeArguments = TSClassImplements | TSInterfaceHeritage; 66export declare type ForInitialiser = Expression | VariableDeclaration; 67export declare type ImportClause = ImportDefaultSpecifier | ImportNamespaceSpecifier | ImportSpecifier; 68export declare type IterationStatement = DoWhileStatement | ForInStatement | ForOfStatement | ForStatement | WhileStatement; 69export declare type JSXChild = JSXElement | JSXExpression | JSXFragment | JSXText; 70export declare type JSXExpression = JSXEmptyExpression | JSXSpreadChild | JSXExpressionContainer; 71export declare type JSXTagNameExpression = JSXIdentifier | JSXMemberExpression; 72export declare type LeftHandSideExpression = CallExpression | ClassExpression | ClassDeclaration | FunctionExpression | LiteralExpression | MemberExpression | OptionalCallExpression | OptionalMemberExpression | PrimaryExpression | TaggedTemplateExpression | TSNonNullExpression | TSAsExpression; 73export declare type Literal = BooleanLiteral | NumberLiteral | NullLiteral | RegExpLiteral | StringLiteral; 74export declare type LiteralExpression = BigIntLiteral | Literal | TemplateLiteral; 75export declare type MemberExpression = MemberExpressionComputedName | MemberExpressionNonComputedName; 76export declare type MethodDefinition = MethodDefinitionComputedName | MethodDefinitionNonComputedName; 77export declare type Modifier = TSAbstractKeyword | TSAsyncKeyword | TSDeclareKeyword | TSExportKeyword | TSPublicKeyword | TSPrivateKeyword | TSProtectedKeyword | TSReadonlyKeyword | TSStaticKeyword; 78export declare type ObjectLiteralElementLike = MethodDefinition | Property | SpreadElement | TSAbstractMethodDefinition; 79export declare type OptionalMemberExpression = OptionalMemberExpressionComputedName | OptionalMemberExpressionNonComputedName; 80export declare type Parameter = AssignmentPattern | RestElement | ArrayPattern | ObjectPattern | Identifier | TSParameterProperty; 81export declare type DestructuringPattern = Identifier | ObjectPattern | ArrayPattern | RestElement | AssignmentPattern | MemberExpression; 82export declare type PrimaryExpression = ArrayExpression | ArrayPattern | ClassExpression | FunctionExpression | Identifier | Import | JSXElement | JSXFragment | JSXOpeningElement | Literal | LiteralExpression | MetaProperty | ObjectExpression | ObjectPattern | Super | TemplateLiteral | ThisExpression | TSNullKeyword; 83export declare type Property = PropertyComputedName | PropertyNonComputedName; 84export declare type PropertyName = PropertyNameComputed | PropertyNameNonComputed; 85export declare type PropertyNameComputed = Expression; 86export declare type PropertyNameNonComputed = Identifier | StringLiteral | NumberLiteral; 87export declare type Statement = BlockStatement | BreakStatement | ContinueStatement | DebuggerStatement | DeclarationStatement | EmptyStatement | ExpressionStatement | IfStatement | IterationStatement | ImportDeclaration | LabeledStatement | TSModuleBlock | ReturnStatement | SwitchStatement | ThrowStatement | TryStatement | VariableDeclaration | WithStatement; 88export declare type TSAbstractClassProperty = TSAbstractClassPropertyComputedName | TSAbstractClassPropertyNonComputedName; 89export declare type TSAbstractMethodDefinition = TSAbstractMethodDefinitionComputedName | TSAbstractMethodDefinitionNonComputedName; 90export declare type TSMethodSignature = TSMethodSignatureComputedName | TSMethodSignatureNonComputedName; 91export declare type TSPropertySignature = TSPropertySignatureComputedName | TSPropertySignatureNonComputedName; 92export declare type TSEnumMember = TSEnumMemberComputedName | TSEnumMemberNonComputedName; 93export declare type TSUnaryExpression = AwaitExpression | LeftHandSideExpression | TSTypeAssertion | UnaryExpression | UpdateExpression; 94export declare type TypeElement = TSCallSignatureDeclaration | TSConstructSignatureDeclaration | TSIndexSignature | TSMethodSignature | TSPropertySignature; 95export declare type TypeNode = ThisExpression | TSAnyKeyword | TSArrayType | TSBigIntKeyword | TSBooleanKeyword | TSClassImplements | 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; 96interface BinaryExpressionBase extends BaseNode { 97 operator: string; 98 left: Expression; 99 right: Expression; 100} 101interface CallExpressionBase extends BaseNode { 102 callee: LeftHandSideExpression; 103 arguments: Expression[]; 104 typeParameters?: TSTypeParameterInstantiation; 105 optional: boolean; 106} 107interface ClassDeclarationBase extends BaseNode { 108 typeParameters?: TSTypeParameterDeclaration; 109 superTypeParameters?: TSTypeParameterInstantiation; 110 id: Identifier | null; 111 body: ClassBody; 112 superClass: LeftHandSideExpression | null; 113 implements?: ExpressionWithTypeArguments[]; 114 abstract?: boolean; 115 declare?: boolean; 116 decorators?: Decorator[]; 117} 118/** this should not be directly used - instead use ClassPropertyComputedNameBase or ClassPropertyNonComputedNameBase */ 119interface ClassPropertyBase extends BaseNode { 120 key: PropertyName; 121 value: Expression | null; 122 computed: boolean; 123 static: boolean; 124 declare: boolean; 125 readonly?: boolean; 126 decorators?: Decorator[]; 127 accessibility?: Accessibility; 128 optional?: boolean; 129 definite?: boolean; 130 typeAnnotation?: TSTypeAnnotation; 131} 132interface ClassPropertyComputedNameBase extends ClassPropertyBase { 133 key: PropertyNameComputed; 134 computed: true; 135} 136interface ClassPropertyNonComputedNameBase extends ClassPropertyBase { 137 key: PropertyNameNonComputed; 138 computed: false; 139} 140interface FunctionDeclarationBase extends BaseNode { 141 id: Identifier | null; 142 generator: boolean; 143 expression: boolean; 144 async: boolean; 145 params: Parameter[]; 146 body?: BlockStatement | null; 147 returnType?: TSTypeAnnotation; 148 typeParameters?: TSTypeParameterDeclaration; 149 declare?: boolean; 150} 151interface FunctionSignatureBase extends BaseNode { 152 params: Parameter[]; 153 returnType?: TSTypeAnnotation; 154 typeParameters?: TSTypeParameterDeclaration; 155} 156interface LiteralBase extends BaseNode { 157 raw: string; 158 value: boolean | number | RegExp | string | null; 159 regex?: { 160 pattern: string; 161 flags: string; 162 }; 163} 164/** this should not be directly used - instead use MemberExpressionComputedNameBase or MemberExpressionNonComputedNameBase */ 165interface MemberExpressionBase extends BaseNode { 166 object: LeftHandSideExpression; 167 property: Expression | Identifier; 168 computed: boolean; 169 optional: boolean; 170} 171interface MemberExpressionComputedNameBase extends MemberExpressionBase { 172 property: Expression; 173 computed: true; 174} 175interface MemberExpressionNonComputedNameBase extends MemberExpressionBase { 176 property: Identifier; 177 computed: false; 178} 179/** this should not be directly used - instead use MethodDefinitionComputedNameBase or MethodDefinitionNonComputedNameBase */ 180interface MethodDefinitionBase extends BaseNode { 181 key: PropertyName; 182 value: FunctionExpression | TSEmptyBodyFunctionExpression; 183 computed: boolean; 184 static: boolean; 185 kind: 'method' | 'get' | 'set' | 'constructor'; 186 decorators?: Decorator[]; 187 accessibility?: Accessibility; 188 typeParameters?: TSTypeParameterDeclaration; 189} 190interface MethodDefinitionComputedNameBase extends MethodDefinitionBase { 191 key: PropertyNameComputed; 192 computed: true; 193} 194interface MethodDefinitionNonComputedNameBase extends MethodDefinitionBase { 195 key: PropertyNameNonComputed; 196 computed: false; 197} 198interface PropertyBase extends BaseNode { 199 type: AST_NODE_TYPES.Property; 200 key: PropertyName; 201 value: Expression | AssignmentPattern | BindingName; 202 computed: boolean; 203 method: boolean; 204 shorthand: boolean; 205 kind: 'init' | 'get' | 'set'; 206} 207interface TSEnumMemberBase extends BaseNode { 208 type: AST_NODE_TYPES.TSEnumMember; 209 id: PropertyNameNonComputed | PropertyNameComputed; 210 initializer?: Expression; 211 computed?: boolean; 212} 213interface TSHeritageBase extends BaseNode { 214 expression: Expression; 215 typeParameters?: TSTypeParameterInstantiation; 216} 217interface TSMethodSignatureBase extends BaseNode { 218 type: AST_NODE_TYPES.TSMethodSignature; 219 key: PropertyName; 220 computed: boolean; 221 params: Parameter[]; 222 optional?: boolean; 223 returnType?: TSTypeAnnotation; 224 readonly?: boolean; 225 typeParameters?: TSTypeParameterDeclaration; 226 accessibility?: Accessibility; 227 export?: boolean; 228 static?: boolean; 229} 230interface TSPropertySignatureBase extends BaseNode { 231 type: AST_NODE_TYPES.TSPropertySignature; 232 key: PropertyName; 233 optional?: boolean; 234 computed: boolean; 235 typeAnnotation?: TSTypeAnnotation; 236 initializer?: Expression; 237 readonly?: boolean; 238 static?: boolean; 239 export?: boolean; 240 accessibility?: Accessibility; 241} 242interface UnaryExpressionBase extends BaseNode { 243 operator: string; 244 prefix: boolean; 245 argument: LeftHandSideExpression | Literal | UnaryExpression; 246} 247export interface ArrayExpression extends BaseNode { 248 type: AST_NODE_TYPES.ArrayExpression; 249 elements: Expression[]; 250} 251export interface ArrayPattern extends BaseNode { 252 type: AST_NODE_TYPES.ArrayPattern; 253 elements: DestructuringPattern[]; 254 typeAnnotation?: TSTypeAnnotation; 255 optional?: boolean; 256 decorators?: Decorator[]; 257} 258export interface ArrowFunctionExpression extends BaseNode { 259 type: AST_NODE_TYPES.ArrowFunctionExpression; 260 generator: boolean; 261 id: null; 262 params: Parameter[]; 263 body: Expression | BlockStatement; 264 async: boolean; 265 expression: boolean; 266 returnType?: TSTypeAnnotation; 267 typeParameters?: TSTypeParameterDeclaration; 268} 269export interface AssignmentExpression extends BinaryExpressionBase { 270 type: AST_NODE_TYPES.AssignmentExpression; 271} 272export interface AssignmentPattern extends BaseNode { 273 type: AST_NODE_TYPES.AssignmentPattern; 274 left: BindingName; 275 right?: Expression; 276 typeAnnotation?: TSTypeAnnotation; 277 optional?: boolean; 278 decorators?: Decorator[]; 279} 280export interface AwaitExpression extends BaseNode { 281 type: AST_NODE_TYPES.AwaitExpression; 282 argument: TSUnaryExpression; 283} 284export interface BigIntLiteral extends LiteralBase { 285 type: AST_NODE_TYPES.BigIntLiteral; 286} 287export interface BinaryExpression extends BinaryExpressionBase { 288 type: AST_NODE_TYPES.BinaryExpression; 289} 290export interface BlockStatement extends BaseNode { 291 type: AST_NODE_TYPES.BlockStatement; 292 body: Statement[]; 293} 294export interface BooleanLiteral extends LiteralBase { 295 type: AST_NODE_TYPES.Literal; 296 value: boolean; 297} 298export interface BreakStatement extends BaseNode { 299 type: AST_NODE_TYPES.BreakStatement; 300 label: Identifier | null; 301} 302export interface CallExpression extends CallExpressionBase { 303 type: AST_NODE_TYPES.CallExpression; 304 optional: false; 305} 306export interface CatchClause extends BaseNode { 307 type: AST_NODE_TYPES.CatchClause; 308 param: BindingName | null; 309 body: BlockStatement; 310} 311export interface ClassBody extends BaseNode { 312 type: AST_NODE_TYPES.ClassBody; 313 body: ClassElement[]; 314} 315export interface ClassDeclaration extends ClassDeclarationBase { 316 type: AST_NODE_TYPES.ClassDeclaration; 317} 318export interface ClassExpression extends ClassDeclarationBase { 319 type: AST_NODE_TYPES.ClassExpression; 320} 321export interface ClassPropertyComputedName extends ClassPropertyComputedNameBase { 322 type: AST_NODE_TYPES.ClassProperty; 323} 324export interface ClassPropertyNonComputedName extends ClassPropertyNonComputedNameBase { 325 type: AST_NODE_TYPES.ClassProperty; 326} 327export interface ConditionalExpression extends BaseNode { 328 type: AST_NODE_TYPES.ConditionalExpression; 329 test: Expression; 330 consequent: Expression; 331 alternate: Expression; 332} 333export interface ContinueStatement extends BaseNode { 334 type: AST_NODE_TYPES.ContinueStatement; 335 label: Identifier | null; 336} 337export interface DebuggerStatement extends BaseNode { 338 type: AST_NODE_TYPES.DebuggerStatement; 339} 340export interface Decorator extends BaseNode { 341 type: AST_NODE_TYPES.Decorator; 342 expression: LeftHandSideExpression; 343} 344export interface DoWhileStatement extends BaseNode { 345 type: AST_NODE_TYPES.DoWhileStatement; 346 test: Expression; 347 body: Statement; 348} 349export interface EmptyStatement extends BaseNode { 350 type: AST_NODE_TYPES.EmptyStatement; 351} 352export interface ExportAllDeclaration extends BaseNode { 353 type: AST_NODE_TYPES.ExportAllDeclaration; 354 source: Expression | null; 355} 356export interface ExportDefaultDeclaration extends BaseNode { 357 type: AST_NODE_TYPES.ExportDefaultDeclaration; 358 declaration: ExportDeclaration | Expression; 359} 360export interface ExportNamedDeclaration extends BaseNode { 361 type: AST_NODE_TYPES.ExportNamedDeclaration; 362 declaration: ExportDeclaration | null; 363 specifiers: ExportSpecifier[]; 364 source: Expression | null; 365} 366export interface ExportSpecifier extends BaseNode { 367 type: AST_NODE_TYPES.ExportSpecifier; 368 local: Identifier; 369 exported: Identifier; 370} 371export interface ExpressionStatement extends BaseNode { 372 type: AST_NODE_TYPES.ExpressionStatement; 373 expression: Expression; 374 directive?: string; 375} 376export interface ForInStatement extends BaseNode { 377 type: AST_NODE_TYPES.ForInStatement; 378 left: ForInitialiser; 379 right: Expression; 380 body: Statement; 381} 382export interface ForOfStatement extends BaseNode { 383 type: AST_NODE_TYPES.ForOfStatement; 384 left: ForInitialiser; 385 right: Expression; 386 body: Statement; 387 await: boolean; 388} 389export interface ForStatement extends BaseNode { 390 type: AST_NODE_TYPES.ForStatement; 391 init: Expression | ForInitialiser | null; 392 test: Expression | null; 393 update: Expression | null; 394 body: Statement; 395} 396export interface FunctionDeclaration extends FunctionDeclarationBase { 397 type: AST_NODE_TYPES.FunctionDeclaration; 398 body: BlockStatement; 399} 400export interface FunctionExpression extends FunctionDeclarationBase { 401 type: AST_NODE_TYPES.FunctionExpression; 402} 403export interface Identifier extends BaseNode { 404 type: AST_NODE_TYPES.Identifier; 405 name: string; 406 typeAnnotation?: TSTypeAnnotation; 407 optional?: boolean; 408 decorators?: Decorator[]; 409} 410export interface IfStatement extends BaseNode { 411 type: AST_NODE_TYPES.IfStatement; 412 test: Expression; 413 consequent: Statement; 414 alternate: Statement | null; 415} 416export interface Import extends BaseNode { 417 type: AST_NODE_TYPES.Import; 418} 419export interface ImportDeclaration extends BaseNode { 420 type: AST_NODE_TYPES.ImportDeclaration; 421 source: Literal; 422 specifiers: ImportClause[]; 423} 424export interface ImportDefaultSpecifier extends BaseNode { 425 type: AST_NODE_TYPES.ImportDefaultSpecifier; 426 local: Identifier; 427} 428export interface ImportNamespaceSpecifier extends BaseNode { 429 type: AST_NODE_TYPES.ImportNamespaceSpecifier; 430 local: Identifier; 431} 432export interface ImportSpecifier extends BaseNode { 433 type: AST_NODE_TYPES.ImportSpecifier; 434 local: Identifier; 435 imported: Identifier; 436} 437export interface JSXAttribute extends BaseNode { 438 type: AST_NODE_TYPES.JSXAttribute; 439 name: JSXIdentifier; 440 value: Literal | JSXExpression | null; 441} 442export interface JSXClosingElement extends BaseNode { 443 type: AST_NODE_TYPES.JSXClosingElement; 444 name: JSXTagNameExpression; 445} 446export interface JSXClosingFragment extends BaseNode { 447 type: AST_NODE_TYPES.JSXClosingFragment; 448} 449export interface JSXElement extends BaseNode { 450 type: AST_NODE_TYPES.JSXElement; 451 openingElement: JSXOpeningElement; 452 closingElement: JSXClosingElement | null; 453 children: JSXChild[]; 454} 455export interface JSXEmptyExpression extends BaseNode { 456 type: AST_NODE_TYPES.JSXEmptyExpression; 457} 458export interface JSXExpressionContainer extends BaseNode { 459 type: AST_NODE_TYPES.JSXExpressionContainer; 460 expression: Expression | JSXEmptyExpression; 461} 462export interface JSXFragment extends BaseNode { 463 type: AST_NODE_TYPES.JSXFragment; 464 openingFragment: JSXOpeningFragment; 465 closingFragment: JSXClosingFragment; 466 children: JSXChild[]; 467} 468export interface JSXIdentifier extends BaseNode { 469 type: AST_NODE_TYPES.JSXIdentifier; 470 name: string; 471} 472export interface JSXMemberExpression extends BaseNode { 473 type: AST_NODE_TYPES.JSXMemberExpression; 474 object: JSXTagNameExpression; 475 property: JSXIdentifier; 476} 477export interface JSXOpeningElement extends BaseNode { 478 type: AST_NODE_TYPES.JSXOpeningElement; 479 typeParameters?: TSTypeParameterInstantiation; 480 selfClosing: boolean; 481 name: JSXTagNameExpression; 482 attributes: JSXAttribute[]; 483} 484export interface JSXOpeningFragment extends BaseNode { 485 type: AST_NODE_TYPES.JSXOpeningFragment; 486} 487export interface JSXSpreadAttribute extends BaseNode { 488 type: AST_NODE_TYPES.JSXSpreadAttribute; 489 argument: Expression; 490} 491export interface JSXSpreadChild extends BaseNode { 492 type: AST_NODE_TYPES.JSXSpreadChild; 493 expression: Expression | JSXEmptyExpression; 494} 495export interface JSXText extends BaseNode { 496 type: AST_NODE_TYPES.JSXText; 497 value: string; 498 raw: string; 499} 500export interface LabeledStatement extends BaseNode { 501 type: AST_NODE_TYPES.LabeledStatement; 502 label: Identifier; 503 body: Statement; 504} 505export interface LogicalExpression extends BinaryExpressionBase { 506 type: AST_NODE_TYPES.LogicalExpression; 507} 508export interface MemberExpressionComputedName extends MemberExpressionComputedNameBase { 509 type: AST_NODE_TYPES.MemberExpression; 510 optional: false; 511} 512export interface MemberExpressionNonComputedName extends MemberExpressionNonComputedNameBase { 513 type: AST_NODE_TYPES.MemberExpression; 514 optional: false; 515} 516export interface MetaProperty extends BaseNode { 517 type: AST_NODE_TYPES.MetaProperty; 518 meta: Identifier; 519 property: Identifier; 520} 521export interface MethodDefinitionComputedName extends MethodDefinitionComputedNameBase { 522 type: AST_NODE_TYPES.MethodDefinition; 523} 524export interface MethodDefinitionNonComputedName extends MethodDefinitionNonComputedNameBase { 525 type: AST_NODE_TYPES.MethodDefinition; 526} 527export interface NewExpression extends BaseNode { 528 type: AST_NODE_TYPES.NewExpression; 529 callee: LeftHandSideExpression; 530 arguments: Expression[]; 531 typeParameters?: TSTypeParameterInstantiation; 532} 533export interface NumberLiteral extends LiteralBase { 534 type: AST_NODE_TYPES.Literal; 535 value: number; 536} 537export interface NullLiteral extends LiteralBase { 538 type: AST_NODE_TYPES.Literal; 539 value: null; 540} 541export interface ObjectExpression extends BaseNode { 542 type: AST_NODE_TYPES.ObjectExpression; 543 properties: ObjectLiteralElementLike[]; 544} 545export interface ObjectPattern extends BaseNode { 546 type: AST_NODE_TYPES.ObjectPattern; 547 properties: (Property | RestElement)[]; 548 typeAnnotation?: TSTypeAnnotation; 549 optional?: boolean; 550 decorators?: Decorator[]; 551} 552export interface OptionalCallExpression extends CallExpressionBase { 553 type: AST_NODE_TYPES.OptionalCallExpression; 554 optional: boolean; 555} 556export interface OptionalMemberExpressionComputedName extends MemberExpressionComputedNameBase { 557 type: AST_NODE_TYPES.OptionalMemberExpression; 558 optional: boolean; 559} 560export interface OptionalMemberExpressionNonComputedName extends MemberExpressionNonComputedNameBase { 561 type: AST_NODE_TYPES.OptionalMemberExpression; 562 optional: boolean; 563} 564export interface Program extends BaseNode { 565 type: AST_NODE_TYPES.Program; 566 body: Statement[]; 567 sourceType: 'module' | 'script'; 568 comments?: Comment[]; 569 tokens?: Token[]; 570} 571export interface PropertyComputedName extends PropertyBase { 572 key: PropertyNameComputed; 573 computed: true; 574} 575export interface PropertyNonComputedName extends PropertyBase { 576 key: PropertyNameNonComputed; 577 computed: false; 578} 579export interface RegExpLiteral extends LiteralBase { 580 type: AST_NODE_TYPES.Literal; 581 value: RegExp; 582} 583export interface RestElement extends BaseNode { 584 type: AST_NODE_TYPES.RestElement; 585 argument: DestructuringPattern; 586 typeAnnotation?: TSTypeAnnotation; 587 optional?: boolean; 588 value?: AssignmentPattern; 589 decorators?: Decorator[]; 590} 591export interface ReturnStatement extends BaseNode { 592 type: AST_NODE_TYPES.ReturnStatement; 593 argument: Expression | null; 594} 595export interface SequenceExpression extends BaseNode { 596 type: AST_NODE_TYPES.SequenceExpression; 597 expressions: Expression[]; 598} 599export interface SpreadElement extends BaseNode { 600 type: AST_NODE_TYPES.SpreadElement; 601 argument: Expression; 602} 603export interface StringLiteral extends LiteralBase { 604 type: AST_NODE_TYPES.Literal; 605 value: string; 606} 607export interface Super extends BaseNode { 608 type: AST_NODE_TYPES.Super; 609} 610export interface SwitchCase extends BaseNode { 611 type: AST_NODE_TYPES.SwitchCase; 612 test: Expression | null; 613 consequent: Statement[]; 614} 615export interface SwitchStatement extends BaseNode { 616 type: AST_NODE_TYPES.SwitchStatement; 617 discriminant: Expression; 618 cases: SwitchCase[]; 619} 620export interface TaggedTemplateExpression extends BaseNode { 621 type: AST_NODE_TYPES.TaggedTemplateExpression; 622 typeParameters?: TSTypeParameterInstantiation; 623 tag: LeftHandSideExpression; 624 quasi: TemplateLiteral; 625} 626export interface TemplateElement extends BaseNode { 627 type: AST_NODE_TYPES.TemplateElement; 628 value: { 629 raw: string; 630 cooked: string; 631 }; 632 tail: boolean; 633} 634export interface TemplateLiteral extends BaseNode { 635 type: AST_NODE_TYPES.TemplateLiteral; 636 quasis: TemplateElement[]; 637 expressions: Expression[]; 638} 639export interface ThisExpression extends BaseNode { 640 type: AST_NODE_TYPES.ThisExpression; 641} 642export interface ThrowStatement extends BaseNode { 643 type: AST_NODE_TYPES.ThrowStatement; 644 argument: Statement | TSAsExpression | null; 645} 646export interface TryStatement extends BaseNode { 647 type: AST_NODE_TYPES.TryStatement; 648 block: BlockStatement; 649 handler: CatchClause | null; 650 finalizer: BlockStatement; 651} 652export interface TSAbstractClassPropertyComputedName extends ClassPropertyComputedNameBase { 653 type: AST_NODE_TYPES.TSAbstractClassProperty; 654} 655export interface TSAbstractClassPropertyNonComputedName extends ClassPropertyNonComputedNameBase { 656 type: AST_NODE_TYPES.TSAbstractClassProperty; 657} 658export interface TSAbstractKeyword extends BaseNode { 659 type: AST_NODE_TYPES.TSAbstractKeyword; 660} 661export interface TSAbstractMethodDefinitionComputedName extends MethodDefinitionComputedNameBase { 662 type: AST_NODE_TYPES.TSAbstractMethodDefinition; 663} 664export interface TSAbstractMethodDefinitionNonComputedName extends MethodDefinitionNonComputedNameBase { 665 type: AST_NODE_TYPES.TSAbstractMethodDefinition; 666} 667export interface TSAnyKeyword extends BaseNode { 668 type: AST_NODE_TYPES.TSAnyKeyword; 669} 670export interface TSArrayType extends BaseNode { 671 type: AST_NODE_TYPES.TSArrayType; 672 elementType: TypeNode; 673} 674export interface TSAsExpression extends BaseNode { 675 type: AST_NODE_TYPES.TSAsExpression; 676 expression: Expression; 677 typeAnnotation: TypeNode; 678} 679export interface TSAsyncKeyword extends BaseNode { 680 type: AST_NODE_TYPES.TSAsyncKeyword; 681} 682export interface TSBigIntKeyword extends BaseNode { 683 type: AST_NODE_TYPES.TSBigIntKeyword; 684} 685export interface TSBooleanKeyword extends BaseNode { 686 type: AST_NODE_TYPES.TSBooleanKeyword; 687} 688export interface TSCallSignatureDeclaration extends FunctionSignatureBase { 689 type: AST_NODE_TYPES.TSCallSignatureDeclaration; 690} 691export interface TSClassImplements extends TSHeritageBase { 692 type: AST_NODE_TYPES.TSClassImplements; 693} 694export interface TSConditionalType extends BaseNode { 695 type: AST_NODE_TYPES.TSConditionalType; 696 checkType: TypeNode; 697 extendsType: TypeNode; 698 trueType: TypeNode; 699 falseType: TypeNode; 700} 701export interface TSConstructorType extends FunctionSignatureBase { 702 type: AST_NODE_TYPES.TSConstructorType; 703} 704export interface TSConstructSignatureDeclaration extends FunctionSignatureBase { 705 type: AST_NODE_TYPES.TSConstructSignatureDeclaration; 706} 707export interface TSDeclareFunction extends FunctionDeclarationBase { 708 type: AST_NODE_TYPES.TSDeclareFunction; 709} 710export interface TSDeclareKeyword extends BaseNode { 711 type: AST_NODE_TYPES.TSDeclareKeyword; 712} 713export interface TSEmptyBodyFunctionExpression extends FunctionDeclarationBase { 714 type: AST_NODE_TYPES.TSEmptyBodyFunctionExpression; 715 body: null; 716} 717export interface TSEnumDeclaration extends BaseNode { 718 type: AST_NODE_TYPES.TSEnumDeclaration; 719 id: Identifier; 720 members: TSEnumMember[]; 721 const?: boolean; 722 declare?: boolean; 723 modifiers?: Modifier[]; 724 decorators?: Decorator[]; 725} 726/** 727 * this should only really happen in semantically invalid code (errors 1164 and 2452) 728 * 729 * VALID: 730 * enum Foo { ['a'] } 731 * 732 * INVALID: 733 * const x = 'a'; 734 * enum Foo { [x] } 735 * enum Bar { ['a' + 'b'] } 736 */ 737export interface TSEnumMemberComputedName extends TSEnumMemberBase { 738 id: PropertyNameComputed; 739 computed: true; 740} 741export interface TSEnumMemberNonComputedName extends TSEnumMemberBase { 742 id: PropertyNameNonComputed; 743 computed?: false; 744} 745export interface TSExportAssignment extends BaseNode { 746 type: AST_NODE_TYPES.TSExportAssignment; 747 expression: Expression; 748} 749export interface TSExportKeyword extends BaseNode { 750 type: AST_NODE_TYPES.TSExportKeyword; 751} 752export interface TSExternalModuleReference extends BaseNode { 753 type: AST_NODE_TYPES.TSExternalModuleReference; 754 expression: Expression; 755} 756export interface TSFunctionType extends FunctionSignatureBase { 757 type: AST_NODE_TYPES.TSFunctionType; 758} 759export interface TSImportEqualsDeclaration extends BaseNode { 760 type: AST_NODE_TYPES.TSImportEqualsDeclaration; 761 id: Identifier; 762 moduleReference: EntityName | TSExternalModuleReference; 763 isExport: boolean; 764} 765export interface TSImportType extends BaseNode { 766 type: AST_NODE_TYPES.TSImportType; 767 isTypeOf: boolean; 768 parameter: TypeNode; 769 qualifier: EntityName | null; 770 typeParameters: TSTypeParameterInstantiation | null; 771} 772export interface TSIndexedAccessType extends BaseNode { 773 type: AST_NODE_TYPES.TSIndexedAccessType; 774 objectType: TypeNode; 775 indexType: TypeNode; 776} 777export interface TSIndexSignature extends BaseNode { 778 type: AST_NODE_TYPES.TSIndexSignature; 779 parameters: Parameter[]; 780 typeAnnotation?: TSTypeAnnotation; 781 readonly?: boolean; 782 accessibility?: Accessibility; 783 export?: boolean; 784 static?: boolean; 785} 786export interface TSInferType extends BaseNode { 787 type: AST_NODE_TYPES.TSInferType; 788 typeParameter: TSTypeParameterDeclaration; 789} 790export interface TSInterfaceDeclaration extends BaseNode { 791 type: AST_NODE_TYPES.TSInterfaceDeclaration; 792 body: TSInterfaceBody; 793 id: Identifier; 794 typeParameters?: TSTypeParameterDeclaration; 795 extends?: ExpressionWithTypeArguments[]; 796 implements?: ExpressionWithTypeArguments[]; 797 decorators?: Decorator[]; 798 abstract?: boolean; 799 declare?: boolean; 800} 801export interface TSInterfaceBody extends BaseNode { 802 type: AST_NODE_TYPES.TSInterfaceBody; 803 body: TypeElement[]; 804} 805export interface TSInterfaceHeritage extends TSHeritageBase { 806 type: AST_NODE_TYPES.TSInterfaceHeritage; 807} 808export interface TSIntersectionType extends BaseNode { 809 type: AST_NODE_TYPES.TSIntersectionType; 810 types: TypeNode[]; 811} 812export interface TSLiteralType extends BaseNode { 813 type: AST_NODE_TYPES.TSLiteralType; 814 literal: LiteralExpression | UnaryExpression | UpdateExpression; 815} 816export interface TSMappedType extends BaseNode { 817 type: AST_NODE_TYPES.TSMappedType; 818 typeParameter: TSTypeParameterDeclaration; 819 readonly?: boolean | '-' | '+'; 820 optional?: boolean | '-' | '+'; 821 typeAnnotation?: TypeNode; 822} 823export interface TSMethodSignatureComputedName extends TSMethodSignatureBase { 824 key: PropertyNameComputed; 825 computed: true; 826} 827export interface TSMethodSignatureNonComputedName extends TSMethodSignatureBase { 828 key: PropertyNameNonComputed; 829 computed: false; 830} 831export interface TSModuleBlock extends BaseNode { 832 type: AST_NODE_TYPES.TSModuleBlock; 833 body: Statement[]; 834} 835export interface TSModuleDeclaration extends BaseNode { 836 type: AST_NODE_TYPES.TSModuleDeclaration; 837 id: Identifier | Literal; 838 body?: TSModuleBlock | TSModuleDeclaration; 839 global?: boolean; 840 declare?: boolean; 841 modifiers?: Modifier[]; 842} 843export interface TSNamespaceExportDeclaration extends BaseNode { 844 type: AST_NODE_TYPES.TSNamespaceExportDeclaration; 845 id: Identifier; 846} 847export interface TSNeverKeyword extends BaseNode { 848 type: AST_NODE_TYPES.TSNeverKeyword; 849} 850export interface TSNonNullExpression extends BaseNode { 851 type: AST_NODE_TYPES.TSNonNullExpression; 852 expression: Expression; 853} 854export interface TSNullKeyword extends BaseNode { 855 type: AST_NODE_TYPES.TSNullKeyword; 856} 857export interface TSNumberKeyword extends BaseNode { 858 type: AST_NODE_TYPES.TSNumberKeyword; 859} 860export interface TSObjectKeyword extends BaseNode { 861 type: AST_NODE_TYPES.TSObjectKeyword; 862} 863export interface TSOptionalType extends BaseNode { 864 type: AST_NODE_TYPES.TSOptionalType; 865 typeAnnotation: TypeNode; 866} 867export interface TSParameterProperty extends BaseNode { 868 type: AST_NODE_TYPES.TSParameterProperty; 869 accessibility?: Accessibility; 870 readonly?: boolean; 871 static?: boolean; 872 export?: boolean; 873 parameter: AssignmentPattern | BindingName | RestElement; 874 decorators?: Decorator[]; 875} 876export interface TSParenthesizedType extends BaseNode { 877 type: AST_NODE_TYPES.TSParenthesizedType; 878 typeAnnotation: TypeNode; 879} 880export interface TSPropertySignatureComputedName extends TSPropertySignatureBase { 881 key: PropertyNameComputed; 882 computed: true; 883} 884export interface TSPropertySignatureNonComputedName extends TSPropertySignatureBase { 885 key: PropertyNameNonComputed; 886 computed: false; 887} 888export interface TSPublicKeyword extends BaseNode { 889 type: AST_NODE_TYPES.TSPublicKeyword; 890} 891export interface TSPrivateKeyword extends BaseNode { 892 type: AST_NODE_TYPES.TSPrivateKeyword; 893} 894export interface TSProtectedKeyword extends BaseNode { 895 type: AST_NODE_TYPES.TSProtectedKeyword; 896} 897export interface TSQualifiedName extends BaseNode { 898 type: AST_NODE_TYPES.TSQualifiedName; 899 left: EntityName; 900 right: Identifier; 901} 902export interface TSReadonlyKeyword extends BaseNode { 903 type: AST_NODE_TYPES.TSReadonlyKeyword; 904} 905export interface TSRestType extends BaseNode { 906 type: AST_NODE_TYPES.TSRestType; 907 typeAnnotation: TypeNode; 908} 909export interface TSStaticKeyword extends BaseNode { 910 type: AST_NODE_TYPES.TSStaticKeyword; 911} 912export interface TSStringKeyword extends BaseNode { 913 type: AST_NODE_TYPES.TSStringKeyword; 914} 915export interface TSSymbolKeyword extends BaseNode { 916 type: AST_NODE_TYPES.TSSymbolKeyword; 917} 918export interface TSThisType extends BaseNode { 919 type: AST_NODE_TYPES.TSThisType; 920} 921export interface TSTupleType extends BaseNode { 922 type: AST_NODE_TYPES.TSTupleType; 923 elementTypes: TypeNode[]; 924} 925export interface TSTypeAliasDeclaration extends BaseNode { 926 type: AST_NODE_TYPES.TSTypeAliasDeclaration; 927 id: Identifier; 928 typeAnnotation: TypeNode; 929 declare?: boolean; 930 typeParameters?: TSTypeParameterDeclaration; 931} 932export interface TSTypeAnnotation extends BaseNode { 933 type: AST_NODE_TYPES.TSTypeAnnotation; 934 typeAnnotation: TypeNode; 935} 936export interface TSTypeAssertion extends BaseNode { 937 type: AST_NODE_TYPES.TSTypeAssertion; 938 typeAnnotation: TypeNode; 939 expression: Expression; 940} 941export interface TSTypeLiteral extends BaseNode { 942 type: AST_NODE_TYPES.TSTypeLiteral; 943 members: TypeElement[]; 944} 945export interface TSTypeOperator extends BaseNode { 946 type: AST_NODE_TYPES.TSTypeOperator; 947 operator: 'keyof' | 'unique' | 'readonly'; 948 typeAnnotation?: TypeNode; 949} 950export interface TSTypeParameter extends BaseNode { 951 type: AST_NODE_TYPES.TSTypeParameter; 952 name: Identifier; 953 constraint?: TypeNode; 954 default?: TypeNode; 955} 956export interface TSTypeParameterDeclaration extends BaseNode { 957 type: AST_NODE_TYPES.TSTypeParameterDeclaration; 958 params: TSTypeParameter[]; 959} 960export interface TSTypeParameterInstantiation extends BaseNode { 961 type: AST_NODE_TYPES.TSTypeParameterInstantiation; 962 params: TypeNode[]; 963} 964export interface TSTypePredicate extends BaseNode { 965 type: AST_NODE_TYPES.TSTypePredicate; 966 asserts: boolean; 967 parameterName: Identifier | TSThisType; 968 typeAnnotation: TSTypeAnnotation | null; 969} 970export interface TSTypeQuery extends BaseNode { 971 type: AST_NODE_TYPES.TSTypeQuery; 972 exprName: EntityName; 973} 974export interface TSTypeReference extends BaseNode { 975 type: AST_NODE_TYPES.TSTypeReference; 976 typeName: EntityName; 977 typeParameters?: TSTypeParameterInstantiation; 978} 979export interface TSUndefinedKeyword extends BaseNode { 980 type: AST_NODE_TYPES.TSUndefinedKeyword; 981} 982export interface TSUnionType extends BaseNode { 983 type: AST_NODE_TYPES.TSUnionType; 984 types: TypeNode[]; 985} 986export interface TSUnknownKeyword extends BaseNode { 987 type: AST_NODE_TYPES.TSUnknownKeyword; 988} 989export interface TSVoidKeyword extends BaseNode { 990 type: AST_NODE_TYPES.TSVoidKeyword; 991} 992export interface UpdateExpression extends UnaryExpressionBase { 993 type: AST_NODE_TYPES.UpdateExpression; 994 operator: '++' | '--'; 995} 996export interface UnaryExpression extends UnaryExpressionBase { 997 type: AST_NODE_TYPES.UnaryExpression; 998 operator: '+' | '-' | '!' | '~' | 'delete' | 'void' | 'typeof'; 999} 1000export interface VariableDeclaration extends BaseNode { 1001 type: AST_NODE_TYPES.VariableDeclaration; 1002 declarations: VariableDeclarator[]; 1003 kind: 'let' | 'const' | 'var'; 1004 declare?: boolean; 1005} 1006export interface VariableDeclarator extends BaseNode { 1007 type: AST_NODE_TYPES.VariableDeclarator; 1008 id: BindingName; 1009 init: Expression | null; 1010 definite?: boolean; 1011} 1012export interface WhileStatement extends BaseNode { 1013 type: AST_NODE_TYPES.WhileStatement; 1014 test: Expression; 1015 body: Statement; 1016} 1017export interface WithStatement extends BaseNode { 1018 type: AST_NODE_TYPES.WithStatement; 1019 object: Expression; 1020 body: Statement; 1021} 1022export interface YieldExpression extends BaseNode { 1023 type: AST_NODE_TYPES.YieldExpression; 1024 delegate: boolean; 1025 argument?: Expression; 1026} 1027export {}; 1028//# sourceMappingURL=ts-estree.d.ts.map