@eslint-react/ast 1.47.4-beta.0 → 1.47.4-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/index.d.mts +2172 -24
  2. package/dist/index.d.ts +2172 -24
  3. package/package.json +2 -2
package/dist/index.d.mts CHANGED
@@ -1,7 +1,8 @@
1
1
  import { _ } from '@eslint-react/eff';
2
- import { TSESTree } from '@typescript-eslint/types';
2
+ import { TSESTree, AST_NODE_TYPES as AST_NODE_TYPES$2 } from '@typescript-eslint/types';
3
3
  import { TSESTree as TSESTree$1 } from '@typescript-eslint/utils';
4
- import { AST_NODE_TYPES } from '@typescript-eslint/typescript-estree';
4
+ import { AST_NODE_TYPES as AST_NODE_TYPES$1 } from '@typescript-eslint/typescript-estree';
5
+ import { SyntaxKind } from 'typescript';
5
6
 
6
7
  /**
7
8
  * Find the parent node that satisfies the test function
@@ -166,7 +167,7 @@ declare function getLiteralValueType(input: bigint | boolean | null | number | s
166
167
  * @returns A partially applied function bound to a predicate of type T. The returned function can be called passing a
167
168
  * node, and it will return an array of all nested expressions of type T.
168
169
  */
169
- declare function getNestedExpressionsOfType<TNodeType extends AST_NODE_TYPES>(type: TNodeType): (node: TSESTree.Node) => Extract<TSESTree.Node, {
170
+ declare function getNestedExpressionsOfType<TNodeType extends AST_NODE_TYPES$1>(type: TNodeType): (node: TSESTree.Node) => Extract<TSESTree.Node, {
170
171
  type: TNodeType;
171
172
  }>[];
172
173
  /**
@@ -198,31 +199,2178 @@ declare function getNestedReturnStatements(node: TSESTree.Node): readonly TSESTr
198
199
 
199
200
  declare function getPropertyName(node: TSESTree.Node): string | _;
200
201
 
201
- declare const is: <NodeType extends TSESTree$1.AST_NODE_TYPES>(nodeType: NodeType) => (node: TSESTree$1.Node | null | undefined) => node is Extract<TSESTree$1.Node, {
202
+ /**********************************************
203
+ * DO NOT MODIFY THIS FILE MANUALLY *
204
+ * *
205
+ * THIS FILE HAS BEEN COPIED FROM ast-spec. *
206
+ * ANY CHANGES WILL BE LOST ON THE NEXT BUILD *
207
+ * *
208
+ * MAKE CHANGES TO ast-spec AND THEN RUN *
209
+ * yarn build *
210
+ **********************************************/
211
+
212
+ declare type Accessibility = 'private' | 'protected' | 'public';
213
+ declare type AccessorProperty = AccessorPropertyComputedName | AccessorPropertyNonComputedName;
214
+ declare interface AccessorPropertyComputedName extends PropertyDefinitionComputedNameBase {
215
+ type: AST_NODE_TYPES.AccessorProperty;
216
+ }
217
+ declare interface AccessorPropertyNonComputedName extends PropertyDefinitionNonComputedNameBase {
218
+ type: AST_NODE_TYPES.AccessorProperty;
219
+ }
220
+ declare interface ArrayExpression extends BaseNode {
221
+ type: AST_NODE_TYPES.ArrayExpression;
222
+ /**
223
+ * an element will be `null` in the case of a sparse array: `[1, ,3]`
224
+ */
225
+ elements: (Expression | SpreadElement | null)[];
226
+ }
227
+ declare interface ArrayPattern extends BaseNode {
228
+ type: AST_NODE_TYPES.ArrayPattern;
229
+ decorators: Decorator[];
230
+ elements: (DestructuringPattern | null)[];
231
+ optional: boolean;
232
+ typeAnnotation: TSTypeAnnotation | undefined;
233
+ }
234
+ declare interface ArrowFunctionExpression extends BaseNode {
235
+ type: AST_NODE_TYPES.ArrowFunctionExpression;
236
+ async: boolean;
237
+ body: BlockStatement | Expression;
238
+ expression: boolean;
239
+ generator: boolean;
240
+ id: null;
241
+ params: Parameter[];
242
+ returnType: TSTypeAnnotation | undefined;
243
+ typeParameters: TSTypeParameterDeclaration | undefined;
244
+ }
245
+ declare interface AssignmentExpression extends BaseNode {
246
+ type: AST_NODE_TYPES.AssignmentExpression;
247
+ left: Expression;
248
+ operator: ValueOf<AssignmentOperatorToText>;
249
+ right: Expression;
250
+ }
251
+ declare interface AssignmentOperatorToText {
252
+ [SyntaxKind.AmpersandAmpersandEqualsToken]: '&&=';
253
+ [SyntaxKind.AmpersandEqualsToken]: '&=';
254
+ [SyntaxKind.AsteriskAsteriskEqualsToken]: '**=';
255
+ [SyntaxKind.AsteriskEqualsToken]: '*=';
256
+ [SyntaxKind.BarBarEqualsToken]: '||=';
257
+ [SyntaxKind.BarEqualsToken]: '|=';
258
+ [SyntaxKind.CaretEqualsToken]: '^=';
259
+ [SyntaxKind.EqualsToken]: '=';
260
+ [SyntaxKind.GreaterThanGreaterThanEqualsToken]: '>>=';
261
+ [SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken]: '>>>=';
262
+ [SyntaxKind.LessThanLessThanEqualsToken]: '<<=';
263
+ [SyntaxKind.MinusEqualsToken]: '-=';
264
+ [SyntaxKind.PercentEqualsToken]: '%=';
265
+ [SyntaxKind.PlusEqualsToken]: '+=';
266
+ [SyntaxKind.QuestionQuestionEqualsToken]: '??=';
267
+ [SyntaxKind.SlashEqualsToken]: '/=';
268
+ }
269
+ declare interface AssignmentPattern extends BaseNode {
270
+ type: AST_NODE_TYPES.AssignmentPattern;
271
+ decorators: Decorator[];
272
+ left: BindingName;
273
+ optional: boolean;
274
+ right: Expression;
275
+ typeAnnotation: TSTypeAnnotation | undefined;
276
+ }
277
+ declare enum AST_NODE_TYPES {
278
+ AccessorProperty = "AccessorProperty",
279
+ ArrayExpression = "ArrayExpression",
280
+ ArrayPattern = "ArrayPattern",
281
+ ArrowFunctionExpression = "ArrowFunctionExpression",
282
+ AssignmentExpression = "AssignmentExpression",
283
+ AssignmentPattern = "AssignmentPattern",
284
+ AwaitExpression = "AwaitExpression",
285
+ BinaryExpression = "BinaryExpression",
286
+ BlockStatement = "BlockStatement",
287
+ BreakStatement = "BreakStatement",
288
+ CallExpression = "CallExpression",
289
+ CatchClause = "CatchClause",
290
+ ChainExpression = "ChainExpression",
291
+ ClassBody = "ClassBody",
292
+ ClassDeclaration = "ClassDeclaration",
293
+ ClassExpression = "ClassExpression",
294
+ ConditionalExpression = "ConditionalExpression",
295
+ ContinueStatement = "ContinueStatement",
296
+ DebuggerStatement = "DebuggerStatement",
297
+ Decorator = "Decorator",
298
+ DoWhileStatement = "DoWhileStatement",
299
+ EmptyStatement = "EmptyStatement",
300
+ ExportAllDeclaration = "ExportAllDeclaration",
301
+ ExportDefaultDeclaration = "ExportDefaultDeclaration",
302
+ ExportNamedDeclaration = "ExportNamedDeclaration",
303
+ ExportSpecifier = "ExportSpecifier",
304
+ ExpressionStatement = "ExpressionStatement",
305
+ ForInStatement = "ForInStatement",
306
+ ForOfStatement = "ForOfStatement",
307
+ ForStatement = "ForStatement",
308
+ FunctionDeclaration = "FunctionDeclaration",
309
+ FunctionExpression = "FunctionExpression",
310
+ Identifier = "Identifier",
311
+ IfStatement = "IfStatement",
312
+ ImportAttribute = "ImportAttribute",
313
+ ImportDeclaration = "ImportDeclaration",
314
+ ImportDefaultSpecifier = "ImportDefaultSpecifier",
315
+ ImportExpression = "ImportExpression",
316
+ ImportNamespaceSpecifier = "ImportNamespaceSpecifier",
317
+ ImportSpecifier = "ImportSpecifier",
318
+ JSXAttribute = "JSXAttribute",
319
+ JSXClosingElement = "JSXClosingElement",
320
+ JSXClosingFragment = "JSXClosingFragment",
321
+ JSXElement = "JSXElement",
322
+ JSXEmptyExpression = "JSXEmptyExpression",
323
+ JSXExpressionContainer = "JSXExpressionContainer",
324
+ JSXFragment = "JSXFragment",
325
+ JSXIdentifier = "JSXIdentifier",
326
+ JSXMemberExpression = "JSXMemberExpression",
327
+ JSXNamespacedName = "JSXNamespacedName",
328
+ JSXOpeningElement = "JSXOpeningElement",
329
+ JSXOpeningFragment = "JSXOpeningFragment",
330
+ JSXSpreadAttribute = "JSXSpreadAttribute",
331
+ JSXSpreadChild = "JSXSpreadChild",
332
+ JSXText = "JSXText",
333
+ LabeledStatement = "LabeledStatement",
334
+ Literal = "Literal",
335
+ LogicalExpression = "LogicalExpression",
336
+ MemberExpression = "MemberExpression",
337
+ MetaProperty = "MetaProperty",
338
+ MethodDefinition = "MethodDefinition",
339
+ NewExpression = "NewExpression",
340
+ ObjectExpression = "ObjectExpression",
341
+ ObjectPattern = "ObjectPattern",
342
+ PrivateIdentifier = "PrivateIdentifier",
343
+ Program = "Program",
344
+ Property = "Property",
345
+ PropertyDefinition = "PropertyDefinition",
346
+ RestElement = "RestElement",
347
+ ReturnStatement = "ReturnStatement",
348
+ SequenceExpression = "SequenceExpression",
349
+ SpreadElement = "SpreadElement",
350
+ StaticBlock = "StaticBlock",
351
+ Super = "Super",
352
+ SwitchCase = "SwitchCase",
353
+ SwitchStatement = "SwitchStatement",
354
+ TaggedTemplateExpression = "TaggedTemplateExpression",
355
+ TemplateElement = "TemplateElement",
356
+ TemplateLiteral = "TemplateLiteral",
357
+ ThisExpression = "ThisExpression",
358
+ ThrowStatement = "ThrowStatement",
359
+ TryStatement = "TryStatement",
360
+ UnaryExpression = "UnaryExpression",
361
+ UpdateExpression = "UpdateExpression",
362
+ VariableDeclaration = "VariableDeclaration",
363
+ VariableDeclarator = "VariableDeclarator",
364
+ WhileStatement = "WhileStatement",
365
+ WithStatement = "WithStatement",
366
+ YieldExpression = "YieldExpression",
367
+ TSAbstractAccessorProperty = "TSAbstractAccessorProperty",
368
+ TSAbstractKeyword = "TSAbstractKeyword",
369
+ TSAbstractMethodDefinition = "TSAbstractMethodDefinition",
370
+ TSAbstractPropertyDefinition = "TSAbstractPropertyDefinition",
371
+ TSAnyKeyword = "TSAnyKeyword",
372
+ TSArrayType = "TSArrayType",
373
+ TSAsExpression = "TSAsExpression",
374
+ TSAsyncKeyword = "TSAsyncKeyword",
375
+ TSBigIntKeyword = "TSBigIntKeyword",
376
+ TSBooleanKeyword = "TSBooleanKeyword",
377
+ TSCallSignatureDeclaration = "TSCallSignatureDeclaration",
378
+ TSClassImplements = "TSClassImplements",
379
+ TSConditionalType = "TSConditionalType",
380
+ TSConstructorType = "TSConstructorType",
381
+ TSConstructSignatureDeclaration = "TSConstructSignatureDeclaration",
382
+ TSDeclareFunction = "TSDeclareFunction",
383
+ TSDeclareKeyword = "TSDeclareKeyword",
384
+ TSEmptyBodyFunctionExpression = "TSEmptyBodyFunctionExpression",
385
+ TSEnumBody = "TSEnumBody",
386
+ TSEnumDeclaration = "TSEnumDeclaration",
387
+ TSEnumMember = "TSEnumMember",
388
+ TSExportAssignment = "TSExportAssignment",
389
+ TSExportKeyword = "TSExportKeyword",
390
+ TSExternalModuleReference = "TSExternalModuleReference",
391
+ TSFunctionType = "TSFunctionType",
392
+ TSImportEqualsDeclaration = "TSImportEqualsDeclaration",
393
+ TSImportType = "TSImportType",
394
+ TSIndexedAccessType = "TSIndexedAccessType",
395
+ TSIndexSignature = "TSIndexSignature",
396
+ TSInferType = "TSInferType",
397
+ TSInstantiationExpression = "TSInstantiationExpression",
398
+ TSInterfaceBody = "TSInterfaceBody",
399
+ TSInterfaceDeclaration = "TSInterfaceDeclaration",
400
+ TSInterfaceHeritage = "TSInterfaceHeritage",
401
+ TSIntersectionType = "TSIntersectionType",
402
+ TSIntrinsicKeyword = "TSIntrinsicKeyword",
403
+ TSLiteralType = "TSLiteralType",
404
+ TSMappedType = "TSMappedType",
405
+ TSMethodSignature = "TSMethodSignature",
406
+ TSModuleBlock = "TSModuleBlock",
407
+ TSModuleDeclaration = "TSModuleDeclaration",
408
+ TSNamedTupleMember = "TSNamedTupleMember",
409
+ TSNamespaceExportDeclaration = "TSNamespaceExportDeclaration",
410
+ TSNeverKeyword = "TSNeverKeyword",
411
+ TSNonNullExpression = "TSNonNullExpression",
412
+ TSNullKeyword = "TSNullKeyword",
413
+ TSNumberKeyword = "TSNumberKeyword",
414
+ TSObjectKeyword = "TSObjectKeyword",
415
+ TSOptionalType = "TSOptionalType",
416
+ TSParameterProperty = "TSParameterProperty",
417
+ TSPrivateKeyword = "TSPrivateKeyword",
418
+ TSPropertySignature = "TSPropertySignature",
419
+ TSProtectedKeyword = "TSProtectedKeyword",
420
+ TSPublicKeyword = "TSPublicKeyword",
421
+ TSQualifiedName = "TSQualifiedName",
422
+ TSReadonlyKeyword = "TSReadonlyKeyword",
423
+ TSRestType = "TSRestType",
424
+ TSSatisfiesExpression = "TSSatisfiesExpression",
425
+ TSStaticKeyword = "TSStaticKeyword",
426
+ TSStringKeyword = "TSStringKeyword",
427
+ TSSymbolKeyword = "TSSymbolKeyword",
428
+ TSTemplateLiteralType = "TSTemplateLiteralType",
429
+ TSThisType = "TSThisType",
430
+ TSTupleType = "TSTupleType",
431
+ TSTypeAliasDeclaration = "TSTypeAliasDeclaration",
432
+ TSTypeAnnotation = "TSTypeAnnotation",
433
+ TSTypeAssertion = "TSTypeAssertion",
434
+ TSTypeLiteral = "TSTypeLiteral",
435
+ TSTypeOperator = "TSTypeOperator",
436
+ TSTypeParameter = "TSTypeParameter",
437
+ TSTypeParameterDeclaration = "TSTypeParameterDeclaration",
438
+ TSTypeParameterInstantiation = "TSTypeParameterInstantiation",
439
+ TSTypePredicate = "TSTypePredicate",
440
+ TSTypeQuery = "TSTypeQuery",
441
+ TSTypeReference = "TSTypeReference",
442
+ TSUndefinedKeyword = "TSUndefinedKeyword",
443
+ TSUnionType = "TSUnionType",
444
+ TSUnknownKeyword = "TSUnknownKeyword",
445
+ TSVoidKeyword = "TSVoidKeyword"
446
+ }
447
+ declare enum AST_TOKEN_TYPES {
448
+ Boolean = "Boolean",
449
+ Identifier = "Identifier",
450
+ JSXIdentifier = "JSXIdentifier",
451
+ PrivateIdentifier = "PrivateIdentifier",
452
+ JSXText = "JSXText",
453
+ Keyword = "Keyword",
454
+ Null = "Null",
455
+ Numeric = "Numeric",
456
+ Punctuator = "Punctuator",
457
+ RegularExpression = "RegularExpression",
458
+ String = "String",
459
+ Template = "Template",
460
+ Block = "Block",
461
+ Line = "Line"
462
+ }
463
+ declare interface AwaitExpression extends BaseNode {
464
+ type: AST_NODE_TYPES.AwaitExpression;
465
+ argument: Expression;
466
+ }
467
+ declare interface BaseNode extends NodeOrTokenData {
468
+ type: AST_NODE_TYPES;
469
+ }
470
+ declare interface BaseToken extends NodeOrTokenData {
471
+ type: AST_TOKEN_TYPES;
472
+ value: string;
473
+ }
474
+ declare interface BigIntLiteral extends LiteralBase {
475
+ bigint: string;
476
+ value: bigint | null;
477
+ }
478
+ declare interface BinaryExpression extends BaseNode {
479
+ type: AST_NODE_TYPES.BinaryExpression;
480
+ left: Expression | PrivateIdentifier;
481
+ operator: ValueOf<BinaryOperatorToText>;
482
+ right: Expression;
483
+ }
484
+ declare interface BinaryOperatorToText {
485
+ [SyntaxKind.AmpersandAmpersandToken]: '&&';
486
+ [SyntaxKind.AmpersandToken]: '&';
487
+ [SyntaxKind.AsteriskAsteriskToken]: '**';
488
+ [SyntaxKind.AsteriskToken]: '*';
489
+ [SyntaxKind.BarBarToken]: '||';
490
+ [SyntaxKind.BarToken]: '|';
491
+ [SyntaxKind.CaretToken]: '^';
492
+ [SyntaxKind.EqualsEqualsEqualsToken]: '===';
493
+ [SyntaxKind.EqualsEqualsToken]: '==';
494
+ [SyntaxKind.ExclamationEqualsEqualsToken]: '!==';
495
+ [SyntaxKind.ExclamationEqualsToken]: '!=';
496
+ [SyntaxKind.GreaterThanEqualsToken]: '>=';
497
+ [SyntaxKind.GreaterThanGreaterThanGreaterThanToken]: '>>>';
498
+ [SyntaxKind.GreaterThanGreaterThanToken]: '>>';
499
+ [SyntaxKind.GreaterThanToken]: '>';
500
+ [SyntaxKind.InKeyword]: 'in';
501
+ [SyntaxKind.InstanceOfKeyword]: 'instanceof';
502
+ [SyntaxKind.LessThanEqualsToken]: '<=';
503
+ [SyntaxKind.LessThanLessThanToken]: '<<';
504
+ [SyntaxKind.LessThanToken]: '<';
505
+ [SyntaxKind.MinusToken]: '-';
506
+ [SyntaxKind.PercentToken]: '%';
507
+ [SyntaxKind.PlusToken]: '+';
508
+ [SyntaxKind.SlashToken]: '/';
509
+ }
510
+ declare type BindingName = BindingPattern | Identifier;
511
+ declare type BindingPattern = ArrayPattern | ObjectPattern;
512
+ declare interface BlockComment extends BaseToken {
513
+ type: AST_TOKEN_TYPES.Block;
514
+ }
515
+ declare interface BlockStatement extends BaseNode {
516
+ type: AST_NODE_TYPES.BlockStatement;
517
+ body: Statement[];
518
+ }
519
+ declare interface BooleanLiteral extends LiteralBase {
520
+ raw: 'false' | 'true';
521
+ value: boolean;
522
+ }
523
+ declare interface BooleanToken extends BaseToken {
524
+ type: AST_TOKEN_TYPES.Boolean;
525
+ }
526
+ declare interface BreakStatement extends BaseNode {
527
+ type: AST_NODE_TYPES.BreakStatement;
528
+ label: Identifier | null;
529
+ }
530
+ declare interface CallExpression extends BaseNode {
531
+ type: AST_NODE_TYPES.CallExpression;
532
+ arguments: CallExpressionArgument[];
533
+ callee: Expression;
534
+ optional: boolean;
535
+ typeArguments: TSTypeParameterInstantiation | undefined;
536
+ }
537
+ declare type CallExpressionArgument = Expression | SpreadElement;
538
+ declare interface CatchClause extends BaseNode {
539
+ type: AST_NODE_TYPES.CatchClause;
540
+ body: BlockStatement;
541
+ param: BindingName | null;
542
+ }
543
+ declare type ChainElement = CallExpression | MemberExpression | TSNonNullExpression;
544
+ declare interface ChainExpression extends BaseNode {
545
+ type: AST_NODE_TYPES.ChainExpression;
546
+ expression: ChainElement;
547
+ }
548
+ declare interface ClassBase extends BaseNode {
549
+ /**
550
+ * Whether the class is an abstract class.
551
+ * @example
552
+ * ```ts
553
+ * abstract class Foo {}
554
+ * ```
555
+ */
556
+ abstract: boolean;
557
+ /**
558
+ * The class body.
559
+ */
560
+ body: ClassBody;
561
+ /**
562
+ * Whether the class has been `declare`d:
563
+ * @example
564
+ * ```ts
565
+ * declare class Foo {}
566
+ * ```
567
+ */
568
+ declare: boolean;
569
+ /**
570
+ * The decorators declared for the class.
571
+ * @example
572
+ * ```ts
573
+ * @deco
574
+ * class Foo {}
575
+ * ```
576
+ */
577
+ decorators: Decorator[];
578
+ /**
579
+ * The class's name.
580
+ * - For a `ClassExpression` this may be `null` if the name is omitted.
581
+ * - For a `ClassDeclaration` this may be `null` if and only if the parent is
582
+ * an `ExportDefaultDeclaration`.
583
+ */
584
+ id: Identifier | null;
585
+ /**
586
+ * The implemented interfaces for the class.
587
+ */
588
+ implements: TSClassImplements[];
589
+ /**
590
+ * The super class this class extends.
591
+ */
592
+ superClass: LeftHandSideExpression | null;
593
+ /**
594
+ * The generic type parameters passed to the superClass.
595
+ */
596
+ superTypeArguments: TSTypeParameterInstantiation | undefined;
597
+ /**
598
+ * The generic type parameters declared for the class.
599
+ */
600
+ typeParameters: TSTypeParameterDeclaration | undefined;
601
+ }
602
+ declare interface ClassBody extends BaseNode {
603
+ type: AST_NODE_TYPES.ClassBody;
604
+ body: ClassElement[];
605
+ }
606
+ declare type ClassDeclaration = ClassDeclarationWithName | ClassDeclarationWithOptionalName;
607
+ declare interface ClassDeclarationBase extends ClassBase {
608
+ type: AST_NODE_TYPES.ClassDeclaration;
609
+ }
610
+ /**
611
+ * A normal class declaration:
612
+ * ```
613
+ * class A {}
614
+ * ```
615
+ */
616
+ declare interface ClassDeclarationWithName extends ClassDeclarationBase {
617
+ id: Identifier;
618
+ }
619
+ /**
620
+ * Default-exported class declarations have optional names:
621
+ * ```
622
+ * export default class {}
623
+ * ```
624
+ */
625
+ declare interface ClassDeclarationWithOptionalName extends ClassDeclarationBase {
626
+ id: Identifier | null;
627
+ }
628
+ declare type ClassElement = AccessorProperty | MethodDefinition | PropertyDefinition | StaticBlock | TSAbstractAccessorProperty | TSAbstractMethodDefinition | TSAbstractPropertyDefinition | TSIndexSignature;
629
+ declare interface ClassExpression extends ClassBase {
630
+ type: AST_NODE_TYPES.ClassExpression;
631
+ abstract: false;
632
+ declare: false;
633
+ }
634
+ declare interface ClassMethodDefinitionNonComputedNameBase extends MethodDefinitionBase {
635
+ computed: false;
636
+ key: ClassPropertyNameNonComputed;
637
+ }
638
+ declare interface ClassPropertyDefinitionNonComputedNameBase extends PropertyDefinitionBase {
639
+ computed: false;
640
+ key: ClassPropertyNameNonComputed;
641
+ }
642
+ declare type ClassPropertyNameNonComputed = PrivateIdentifier | PropertyNameNonComputed;
643
+ declare type Comment = BlockComment | LineComment;
644
+ declare interface ConditionalExpression extends BaseNode {
645
+ type: AST_NODE_TYPES.ConditionalExpression;
646
+ alternate: Expression;
647
+ consequent: Expression;
648
+ test: Expression;
649
+ }
650
+ declare interface ConstDeclaration extends LetOrConstOrVarDeclarationBase {
651
+ /**
652
+ * In a `declare const` declaration, the declarators may have initializers, but
653
+ * not definite assignment assertions. Each declarator cannot have both an
654
+ * initializer and a type annotation.
655
+ *
656
+ * Even if the declaration has no `declare`, it may still be ambient and have
657
+ * no initializer.
658
+ */
659
+ declarations: VariableDeclaratorMaybeInit[];
660
+ kind: 'const';
661
+ }
662
+ declare interface ContinueStatement extends BaseNode {
663
+ type: AST_NODE_TYPES.ContinueStatement;
664
+ label: Identifier | null;
665
+ }
666
+ declare interface DebuggerStatement extends BaseNode {
667
+ type: AST_NODE_TYPES.DebuggerStatement;
668
+ }
669
+ declare interface Decorator extends BaseNode {
670
+ type: AST_NODE_TYPES.Decorator;
671
+ expression: LeftHandSideExpression;
672
+ }
673
+ declare type DefaultExportDeclarations = ClassDeclarationWithOptionalName | Expression | FunctionDeclarationWithName | FunctionDeclarationWithOptionalName | TSDeclareFunction | TSEnumDeclaration | TSInterfaceDeclaration | TSModuleDeclaration | TSTypeAliasDeclaration | VariableDeclaration;
674
+ declare type DestructuringPattern = ArrayPattern | AssignmentPattern | Identifier | MemberExpression | ObjectPattern | RestElement;
675
+ declare interface DoWhileStatement extends BaseNode {
676
+ type: AST_NODE_TYPES.DoWhileStatement;
677
+ body: Statement;
678
+ test: Expression;
679
+ }
680
+ declare interface EmptyStatement extends BaseNode {
681
+ type: AST_NODE_TYPES.EmptyStatement;
682
+ }
683
+ declare type EntityName = Identifier | ThisExpression | TSQualifiedName;
684
+ declare interface ExportAllDeclaration extends BaseNode {
685
+ type: AST_NODE_TYPES.ExportAllDeclaration;
686
+ /**
687
+ * The assertions declared for the export.
688
+ * @example
689
+ * ```ts
690
+ * export * from 'mod' assert \{ type: 'json' \};
691
+ * ```
692
+ * @deprecated Replaced with {@link `attributes`}.
693
+ */
694
+ assertions: ImportAttribute[];
695
+ /**
696
+ * The attributes declared for the export.
697
+ * @example
698
+ * ```ts
699
+ * export * from 'mod' with \{ type: 'json' \};
700
+ * ```
701
+ */
702
+ attributes: ImportAttribute[];
703
+ /**
704
+ * The name for the exported items (`as X`). `null` if no name is assigned.
705
+ */
706
+ exported: Identifier | null;
707
+ /**
708
+ * The kind of the export.
709
+ */
710
+ exportKind: ExportKind;
711
+ /**
712
+ * The source module being exported from.
713
+ */
714
+ source: StringLiteral;
715
+ }
716
+ declare type ExportAndImportKind = 'type' | 'value';
717
+ declare interface ExportDefaultDeclaration extends BaseNode {
718
+ type: AST_NODE_TYPES.ExportDefaultDeclaration;
719
+ /**
720
+ * The declaration being exported.
721
+ */
722
+ declaration: DefaultExportDeclarations;
723
+ /**
724
+ * The kind of the export. Always `value` for default exports.
725
+ */
726
+ exportKind: 'value';
727
+ }
728
+ declare type ExportKind = ExportAndImportKind;
729
+ declare type ExportNamedDeclaration = ExportNamedDeclarationWithoutSourceWithMultiple | ExportNamedDeclarationWithoutSourceWithSingle | ExportNamedDeclarationWithSource;
730
+ declare interface ExportNamedDeclarationBase extends BaseNode {
731
+ type: AST_NODE_TYPES.ExportNamedDeclaration;
732
+ /**
733
+ * The assertions declared for the export.
734
+ * @example
735
+ * ```ts
736
+ * export { foo } from 'mod' assert \{ type: 'json' \};
737
+ * ```
738
+ * This will be an empty array if `source` is `null`
739
+ * @deprecated Replaced with {@link `attributes`}.
740
+ */
741
+ assertions: ImportAttribute[];
742
+ /**
743
+ * The attributes declared for the export.
744
+ * @example
745
+ * ```ts
746
+ * export { foo } from 'mod' with \{ type: 'json' \};
747
+ * ```
748
+ * This will be an empty array if `source` is `null`
749
+ */
750
+ attributes: ImportAttribute[];
751
+ /**
752
+ * The exported declaration.
753
+ * @example
754
+ * ```ts
755
+ * export const x = 1;
756
+ * ```
757
+ * This will be `null` if `source` is not `null`, or if there are `specifiers`
758
+ */
759
+ declaration: NamedExportDeclarations | null;
760
+ /**
761
+ * The kind of the export.
762
+ */
763
+ exportKind: ExportKind;
764
+ /**
765
+ * The source module being exported from.
766
+ */
767
+ source: StringLiteral | null;
768
+ /**
769
+ * The specifiers being exported.
770
+ * @example
771
+ * ```ts
772
+ * export { a, b };
773
+ * ```
774
+ * This will be an empty array if `declaration` is not `null`
775
+ */
776
+ specifiers: ExportSpecifier[];
777
+ }
778
+ /**
779
+ * Exporting names from the current module.
780
+ * ```
781
+ * export {};
782
+ * export { a, b };
783
+ * ```
784
+ */
785
+ declare interface ExportNamedDeclarationWithoutSourceWithMultiple extends ExportNamedDeclarationBase {
786
+ /**
787
+ * This will always be an empty array.
788
+ * @deprecated Replaced with {@link `attributes`}.
789
+ */
790
+ assertions: ImportAttribute[];
791
+ /**
792
+ * This will always be an empty array.
793
+ */
794
+ attributes: ImportAttribute[];
795
+ declaration: null;
796
+ source: null;
797
+ specifiers: ExportSpecifierWithIdentifierLocal[];
798
+ }
799
+ /**
800
+ * Exporting a single named declaration.
801
+ * ```
802
+ * export const x = 1;
803
+ * ```
804
+ */
805
+ declare interface ExportNamedDeclarationWithoutSourceWithSingle extends ExportNamedDeclarationBase {
806
+ /**
807
+ * This will always be an empty array.
808
+ * @deprecated Replaced with {@link `attributes`}.
809
+ */
810
+ assertions: ImportAttribute[];
811
+ /**
812
+ * This will always be an empty array.
813
+ */
814
+ attributes: ImportAttribute[];
815
+ declaration: NamedExportDeclarations;
816
+ source: null;
817
+ /**
818
+ * This will always be an empty array.
819
+ */
820
+ specifiers: ExportSpecifierWithIdentifierLocal[];
821
+ }
822
+ /**
823
+ * Export names from another module.
824
+ * ```
825
+ * export { a, b } from 'mod';
826
+ * ```
827
+ */
828
+ declare interface ExportNamedDeclarationWithSource extends ExportNamedDeclarationBase {
829
+ declaration: null;
830
+ source: StringLiteral;
831
+ }
832
+ declare type ExportSpecifier = ExportSpecifierWithIdentifierLocal | ExportSpecifierWithStringOrLiteralLocal;
833
+ declare interface ExportSpecifierBase extends BaseNode {
834
+ type: AST_NODE_TYPES.ExportSpecifier;
835
+ exported: Identifier | StringLiteral;
836
+ exportKind: ExportKind;
837
+ local: Identifier | StringLiteral;
838
+ }
839
+ declare interface ExportSpecifierWithIdentifierLocal extends ExportSpecifierBase {
840
+ local: Identifier;
841
+ }
842
+ declare interface ExportSpecifierWithStringOrLiteralLocal extends ExportSpecifierBase {
843
+ local: Identifier | StringLiteral;
844
+ }
845
+ declare type Expression = ArrayExpression | ArrayPattern | ArrowFunctionExpression | AssignmentExpression | AwaitExpression | BinaryExpression | CallExpression | ChainExpression | ClassExpression | ConditionalExpression | FunctionExpression | Identifier | ImportExpression | JSXElement | JSXFragment | LiteralExpression | LogicalExpression | MemberExpression | MetaProperty | NewExpression | ObjectExpression | ObjectPattern | SequenceExpression | Super | TaggedTemplateExpression | TemplateLiteral | ThisExpression | TSAsExpression | TSInstantiationExpression | TSNonNullExpression | TSSatisfiesExpression | TSTypeAssertion | UnaryExpression | UpdateExpression | YieldExpression;
846
+ declare interface ExpressionStatement extends BaseNode {
847
+ type: AST_NODE_TYPES.ExpressionStatement;
848
+ directive: string | undefined;
849
+ expression: Expression;
850
+ }
851
+ declare type ForInitialiser = Expression | LetOrConstOrVarDeclaration;
852
+ declare interface ForInStatement extends BaseNode {
853
+ type: AST_NODE_TYPES.ForInStatement;
854
+ body: Statement;
855
+ left: ForInitialiser;
856
+ right: Expression;
857
+ }
858
+ declare type ForOfInitialiser = Expression | LetOrConstOrVarDeclaration | UsingInForOfDeclaration;
859
+ declare interface ForOfStatement extends BaseNode {
860
+ type: AST_NODE_TYPES.ForOfStatement;
861
+ await: boolean;
862
+ body: Statement;
863
+ left: ForOfInitialiser;
864
+ right: Expression;
865
+ }
866
+ declare interface ForStatement extends BaseNode {
867
+ type: AST_NODE_TYPES.ForStatement;
868
+ body: Statement;
869
+ init: Expression | ForInitialiser | null;
870
+ test: Expression | null;
871
+ update: Expression | null;
872
+ }
873
+ declare interface FunctionBase extends BaseNode {
874
+ /**
875
+ * Whether the function is async:
876
+ * ```
877
+ * async function foo() {}
878
+ * const x = async function () {}
879
+ * const x = async () => {}
880
+ * ```
881
+ */
882
+ async: boolean;
883
+ /**
884
+ * The body of the function.
885
+ * - For an `ArrowFunctionExpression` this may be an `Expression` or `BlockStatement`.
886
+ * - For a `FunctionDeclaration` or `FunctionExpression` this is always a `BlockStatement`.
887
+ * - For a `TSDeclareFunction` this is always `undefined`.
888
+ * - For a `TSEmptyBodyFunctionExpression` this is always `null`.
889
+ */
890
+ body: BlockStatement | Expression | null | undefined;
891
+ /**
892
+ * This is only `true` if and only if the node is a `TSDeclareFunction` and it has `declare`:
893
+ * ```
894
+ * declare function foo() {}
895
+ * ```
896
+ */
897
+ declare: boolean;
898
+ /**
899
+ * This is only ever `true` if and only the node is an `ArrowFunctionExpression` and the body
900
+ * is an expression:
901
+ * ```
902
+ * (() => 1)
903
+ * ```
904
+ */
905
+ expression: boolean;
906
+ /**
907
+ * Whether the function is a generator function:
908
+ * ```
909
+ * function *foo() {}
910
+ * const x = function *() {}
911
+ * ```
912
+ * This is always `false` for arrow functions as they cannot be generators.
913
+ */
914
+ generator: boolean;
915
+ /**
916
+ * The function's name.
917
+ * - For an `ArrowFunctionExpression` this is always `null`.
918
+ * - For a `FunctionExpression` this may be `null` if the name is omitted.
919
+ * - For a `FunctionDeclaration` or `TSDeclareFunction` this may be `null` if
920
+ * and only if the parent is an `ExportDefaultDeclaration`.
921
+ */
922
+ id: Identifier | null;
923
+ /**
924
+ * The list of parameters declared for the function.
925
+ */
926
+ params: Parameter[];
927
+ /**
928
+ * The return type annotation for the function.
929
+ */
930
+ returnType: TSTypeAnnotation | undefined;
931
+ /**
932
+ * The generic type parameter declaration for the function.
933
+ */
934
+ typeParameters: TSTypeParameterDeclaration | undefined;
935
+ }
936
+ declare type FunctionDeclaration = FunctionDeclarationWithName | FunctionDeclarationWithOptionalName;
937
+ declare interface FunctionDeclarationBase extends FunctionBase {
938
+ type: AST_NODE_TYPES.FunctionDeclaration;
939
+ body: BlockStatement;
940
+ declare: false;
941
+ expression: false;
942
+ }
943
+ /**
944
+ * A normal function declaration:
945
+ * ```
946
+ * function f() {}
947
+ * ```
948
+ */
949
+ declare interface FunctionDeclarationWithName extends FunctionDeclarationBase {
950
+ id: Identifier;
951
+ }
952
+ /**
953
+ * Default-exported function declarations have optional names:
954
+ * ```
955
+ * export default function () {}
956
+ * ```
957
+ */
958
+ declare interface FunctionDeclarationWithOptionalName extends FunctionDeclarationBase {
959
+ id: Identifier | null;
960
+ }
961
+ declare interface FunctionExpression extends FunctionBase {
962
+ type: AST_NODE_TYPES.FunctionExpression;
963
+ body: BlockStatement;
964
+ expression: false;
965
+ }
966
+ declare interface Identifier extends BaseNode {
967
+ type: AST_NODE_TYPES.Identifier;
968
+ decorators: Decorator[];
969
+ name: string;
970
+ optional: boolean;
971
+ typeAnnotation: TSTypeAnnotation | undefined;
972
+ }
973
+ declare interface IdentifierToken extends BaseToken {
974
+ type: AST_TOKEN_TYPES.Identifier;
975
+ }
976
+ declare interface IfStatement extends BaseNode {
977
+ type: AST_NODE_TYPES.IfStatement;
978
+ alternate: Statement | null;
979
+ consequent: Statement;
980
+ test: Expression;
981
+ }
982
+ declare interface ImportAttribute extends BaseNode {
983
+ type: AST_NODE_TYPES.ImportAttribute;
984
+ key: Identifier | Literal;
985
+ value: Literal;
986
+ }
987
+ declare type ImportClause = ImportDefaultSpecifier | ImportNamespaceSpecifier | ImportSpecifier;
988
+ declare interface ImportDeclaration extends BaseNode {
989
+ type: AST_NODE_TYPES.ImportDeclaration;
990
+ /**
991
+ * The assertions declared for the export.
992
+ * @example
993
+ * ```ts
994
+ * import * from 'mod' assert \{ type: 'json' \};
995
+ * ```
996
+ * @deprecated Replaced with {@link `attributes`}.
997
+ */
998
+ assertions: ImportAttribute[];
999
+ /**
1000
+ * The attributes declared for the export.
1001
+ * @example
1002
+ * ```ts
1003
+ * import * from 'mod' with \{ type: 'json' \};
1004
+ * ```
1005
+ */
1006
+ attributes: ImportAttribute[];
1007
+ /**
1008
+ * The kind of the import.
1009
+ */
1010
+ importKind: ImportKind;
1011
+ /**
1012
+ * The source module being imported from.
1013
+ */
1014
+ source: StringLiteral;
1015
+ /**
1016
+ * The specifiers being imported.
1017
+ * If this is an empty array then either there are no specifiers:
1018
+ * ```
1019
+ * import {} from 'mod';
1020
+ * ```
1021
+ * Or it is a side-effect import:
1022
+ * ```
1023
+ * import 'mod';
1024
+ * ```
1025
+ */
1026
+ specifiers: ImportClause[];
1027
+ }
1028
+ declare interface ImportDefaultSpecifier extends BaseNode {
1029
+ type: AST_NODE_TYPES.ImportDefaultSpecifier;
1030
+ local: Identifier;
1031
+ }
1032
+ declare interface ImportExpression extends BaseNode {
1033
+ type: AST_NODE_TYPES.ImportExpression;
1034
+ /**
1035
+ * The attributes declared for the dynamic import.
1036
+ * @example
1037
+ * ```ts
1038
+ * import('mod', \{ assert: \{ type: 'json' \} \});
1039
+ * ```
1040
+ * @deprecated Replaced with {@link `options`}.
1041
+ */
1042
+ attributes: Expression | null;
1043
+ /**
1044
+ * The options bag declared for the dynamic import.
1045
+ * @example
1046
+ * ```ts
1047
+ * import('mod', \{ assert: \{ type: 'json' \} \});
1048
+ * ```
1049
+ */
1050
+ options: Expression | null;
1051
+ source: Expression;
1052
+ }
1053
+ declare type ImportKind = ExportAndImportKind;
1054
+ declare interface ImportNamespaceSpecifier extends BaseNode {
1055
+ type: AST_NODE_TYPES.ImportNamespaceSpecifier;
1056
+ local: Identifier;
1057
+ }
1058
+ declare interface ImportSpecifier extends BaseNode {
1059
+ type: AST_NODE_TYPES.ImportSpecifier;
1060
+ imported: Identifier | StringLiteral;
1061
+ importKind: ImportKind;
1062
+ local: Identifier;
1063
+ }
1064
+ declare interface JSXAttribute extends BaseNode {
1065
+ type: AST_NODE_TYPES.JSXAttribute;
1066
+ name: JSXIdentifier | JSXNamespacedName;
1067
+ value: JSXElement | JSXExpression | Literal | null;
1068
+ }
1069
+ declare type JSXChild = JSXElement | JSXExpression | JSXFragment | JSXText;
1070
+ declare interface JSXClosingElement extends BaseNode {
1071
+ type: AST_NODE_TYPES.JSXClosingElement;
1072
+ name: JSXTagNameExpression;
1073
+ }
1074
+ declare interface JSXClosingFragment extends BaseNode {
1075
+ type: AST_NODE_TYPES.JSXClosingFragment;
1076
+ }
1077
+ declare interface JSXElement extends BaseNode {
1078
+ type: AST_NODE_TYPES.JSXElement;
1079
+ children: JSXChild[];
1080
+ closingElement: JSXClosingElement | null;
1081
+ openingElement: JSXOpeningElement;
1082
+ }
1083
+ declare interface JSXEmptyExpression extends BaseNode {
1084
+ type: AST_NODE_TYPES.JSXEmptyExpression;
1085
+ }
1086
+ declare type JSXExpression = JSXExpressionContainer | JSXSpreadChild;
1087
+ declare interface JSXExpressionContainer extends BaseNode {
1088
+ type: AST_NODE_TYPES.JSXExpressionContainer;
1089
+ expression: Expression | JSXEmptyExpression;
1090
+ }
1091
+ declare interface JSXFragment extends BaseNode {
1092
+ type: AST_NODE_TYPES.JSXFragment;
1093
+ children: JSXChild[];
1094
+ closingFragment: JSXClosingFragment;
1095
+ openingFragment: JSXOpeningFragment;
1096
+ }
1097
+ declare interface JSXIdentifier extends BaseNode {
1098
+ type: AST_NODE_TYPES.JSXIdentifier;
1099
+ name: string;
1100
+ }
1101
+ declare interface JSXIdentifierToken extends BaseToken {
1102
+ type: AST_TOKEN_TYPES.JSXIdentifier;
1103
+ }
1104
+ declare interface JSXMemberExpression extends BaseNode {
1105
+ type: AST_NODE_TYPES.JSXMemberExpression;
1106
+ object: JSXTagNameExpression;
1107
+ property: JSXIdentifier;
1108
+ }
1109
+ declare interface JSXNamespacedName extends BaseNode {
1110
+ type: AST_NODE_TYPES.JSXNamespacedName;
1111
+ name: JSXIdentifier;
1112
+ namespace: JSXIdentifier;
1113
+ }
1114
+ declare interface JSXOpeningElement extends BaseNode {
1115
+ type: AST_NODE_TYPES.JSXOpeningElement;
1116
+ attributes: (JSXAttribute | JSXSpreadAttribute)[];
1117
+ name: JSXTagNameExpression;
1118
+ selfClosing: boolean;
1119
+ typeArguments: TSTypeParameterInstantiation | undefined;
1120
+ }
1121
+ declare interface JSXOpeningFragment extends BaseNode {
1122
+ type: AST_NODE_TYPES.JSXOpeningFragment;
1123
+ }
1124
+ declare interface JSXSpreadAttribute extends BaseNode {
1125
+ type: AST_NODE_TYPES.JSXSpreadAttribute;
1126
+ argument: Expression;
1127
+ }
1128
+ declare interface JSXSpreadChild extends BaseNode {
1129
+ type: AST_NODE_TYPES.JSXSpreadChild;
1130
+ expression: Expression | JSXEmptyExpression;
1131
+ }
1132
+ declare type JSXTagNameExpression = JSXIdentifier | JSXMemberExpression | JSXNamespacedName;
1133
+ declare interface JSXText extends BaseNode {
1134
+ type: AST_NODE_TYPES.JSXText;
1135
+ raw: string;
1136
+ value: string;
1137
+ }
1138
+ declare interface JSXTextToken extends BaseToken {
1139
+ type: AST_TOKEN_TYPES.JSXText;
1140
+ }
1141
+ declare interface KeywordToken extends BaseToken {
1142
+ type: AST_TOKEN_TYPES.Keyword;
1143
+ }
1144
+ declare interface LabeledStatement extends BaseNode {
1145
+ type: AST_NODE_TYPES.LabeledStatement;
1146
+ body: Statement;
1147
+ label: Identifier;
1148
+ }
1149
+ declare type LeftHandSideExpression = ArrayExpression | ArrayPattern | ArrowFunctionExpression | CallExpression | ClassExpression | FunctionExpression | Identifier | JSXElement | JSXFragment | LiteralExpression | MemberExpression | MetaProperty | ObjectExpression | ObjectPattern | SequenceExpression | Super | TaggedTemplateExpression | ThisExpression | TSAsExpression | TSNonNullExpression | TSTypeAssertion;
1150
+ declare type LetOrConstOrVarDeclaration = ConstDeclaration | LetOrVarDeclaredDeclaration | LetOrVarNonDeclaredDeclaration;
1151
+ declare interface LetOrConstOrVarDeclarationBase extends BaseNode {
1152
+ type: AST_NODE_TYPES.VariableDeclaration;
1153
+ /**
1154
+ * The variables declared by this declaration.
1155
+ * Always non-empty.
1156
+ * @example
1157
+ * ```ts
1158
+ * let x;
1159
+ * let y, z;
1160
+ * ```
1161
+ */
1162
+ declarations: LetOrConstOrVarDeclarator[];
1163
+ /**
1164
+ * Whether the declaration is `declare`d
1165
+ * @example
1166
+ * ```ts
1167
+ * declare const x = 1;
1168
+ * ```
1169
+ */
1170
+ declare: boolean;
1171
+ /**
1172
+ * The keyword used to declare the variable(s)
1173
+ * @example
1174
+ * ```ts
1175
+ * const x = 1;
1176
+ * let y = 2;
1177
+ * var z = 3;
1178
+ * ```
1179
+ */
1180
+ kind: 'const' | 'let' | 'var';
1181
+ }
1182
+ declare type LetOrConstOrVarDeclarator = VariableDeclaratorDefiniteAssignment | VariableDeclaratorMaybeInit | VariableDeclaratorNoInit;
1183
+ declare interface LetOrVarDeclaredDeclaration extends LetOrConstOrVarDeclarationBase {
1184
+ /**
1185
+ * In a `declare let` declaration, the declarators must not have definite assignment
1186
+ * assertions or initializers.
1187
+ *
1188
+ * @example
1189
+ * ```ts
1190
+ * using x = 1;
1191
+ * using y =1, z = 2;
1192
+ * ```
1193
+ */
1194
+ declarations: VariableDeclaratorNoInit[];
1195
+ declare: true;
1196
+ kind: 'let' | 'var';
1197
+ }
1198
+ declare interface LetOrVarNonDeclaredDeclaration extends LetOrConstOrVarDeclarationBase {
1199
+ /**
1200
+ * In a `let`/`var` declaration, the declarators may have definite assignment
1201
+ * assertions or initializers, but not both.
1202
+ */
1203
+ declarations: (VariableDeclaratorDefiniteAssignment | VariableDeclaratorMaybeInit)[];
1204
+ declare: false;
1205
+ kind: 'let' | 'var';
1206
+ }
1207
+ declare interface LineComment extends BaseToken {
1208
+ type: AST_TOKEN_TYPES.Line;
1209
+ }
1210
+ declare type Literal = BigIntLiteral | BooleanLiteral | NullLiteral | NumberLiteral | RegExpLiteral | StringLiteral;
1211
+ declare interface LiteralBase extends BaseNode {
1212
+ type: AST_NODE_TYPES.Literal;
1213
+ raw: string;
1214
+ value: bigint | boolean | number | string | RegExp | null;
1215
+ }
1216
+ declare type LiteralExpression = Literal | TemplateLiteral;
1217
+ declare interface LogicalExpression extends BaseNode {
1218
+ type: AST_NODE_TYPES.LogicalExpression;
1219
+ left: Expression;
1220
+ operator: '&&' | '??' | '||';
1221
+ right: Expression;
1222
+ }
1223
+ declare type MemberExpression = MemberExpressionComputedName | MemberExpressionNonComputedName;
1224
+ declare interface MemberExpressionBase extends BaseNode {
1225
+ computed: boolean;
1226
+ object: Expression;
1227
+ optional: boolean;
1228
+ property: Expression | Identifier | PrivateIdentifier;
1229
+ }
1230
+ declare interface MemberExpressionComputedName extends MemberExpressionBase {
1231
+ type: AST_NODE_TYPES.MemberExpression;
1232
+ computed: true;
1233
+ property: Expression;
1234
+ }
1235
+ declare interface MemberExpressionNonComputedName extends MemberExpressionBase {
1236
+ type: AST_NODE_TYPES.MemberExpression;
1237
+ computed: false;
1238
+ property: Identifier | PrivateIdentifier;
1239
+ }
1240
+ declare interface MetaProperty extends BaseNode {
1241
+ type: AST_NODE_TYPES.MetaProperty;
1242
+ meta: Identifier;
1243
+ property: Identifier;
1244
+ }
1245
+ declare type MethodDefinition = MethodDefinitionComputedName | MethodDefinitionNonComputedName;
1246
+ /** this should not be directly used - instead use MethodDefinitionComputedNameBase or MethodDefinitionNonComputedNameBase */
1247
+ declare interface MethodDefinitionBase extends BaseNode {
1248
+ accessibility: Accessibility | undefined;
1249
+ computed: boolean;
1250
+ decorators: Decorator[];
1251
+ key: PropertyName;
1252
+ kind: 'constructor' | 'get' | 'method' | 'set';
1253
+ optional: boolean;
1254
+ override: boolean;
1255
+ static: boolean;
1256
+ value: FunctionExpression | TSEmptyBodyFunctionExpression;
1257
+ }
1258
+ declare interface MethodDefinitionComputedName extends MethodDefinitionComputedNameBase {
1259
+ type: AST_NODE_TYPES.MethodDefinition;
1260
+ }
1261
+ declare interface MethodDefinitionComputedNameBase extends MethodDefinitionBase {
1262
+ computed: true;
1263
+ key: PropertyNameComputed;
1264
+ }
1265
+ declare interface MethodDefinitionNonComputedName extends ClassMethodDefinitionNonComputedNameBase {
1266
+ type: AST_NODE_TYPES.MethodDefinition;
1267
+ }
1268
+ declare interface MethodDefinitionNonComputedNameBase extends MethodDefinitionBase {
1269
+ computed: false;
1270
+ key: PropertyNameNonComputed;
1271
+ }
1272
+ declare type NamedExportDeclarations = ClassDeclarationWithName | ClassDeclarationWithOptionalName | FunctionDeclarationWithName | FunctionDeclarationWithOptionalName | TSDeclareFunction | TSEnumDeclaration | TSImportEqualsDeclaration | TSInterfaceDeclaration | TSModuleDeclaration | TSTypeAliasDeclaration | VariableDeclaration;
1273
+ declare interface NewExpression extends BaseNode {
1274
+ type: AST_NODE_TYPES.NewExpression;
1275
+ arguments: CallExpressionArgument[];
1276
+ callee: Expression;
1277
+ typeArguments: TSTypeParameterInstantiation | undefined;
1278
+ }
1279
+ declare type Node = AccessorProperty | ArrayExpression | ArrayPattern | ArrowFunctionExpression | AssignmentExpression | AssignmentPattern | AwaitExpression | BinaryExpression | BlockStatement | BreakStatement | CallExpression | CatchClause | ChainExpression | ClassBody | ClassDeclaration | ClassExpression | ConditionalExpression | ContinueStatement | DebuggerStatement | Decorator | DoWhileStatement | EmptyStatement | ExportAllDeclaration | ExportDefaultDeclaration | ExportNamedDeclaration | ExportSpecifier | ExpressionStatement | ForInStatement | ForOfStatement | ForStatement | FunctionDeclaration | FunctionExpression | Identifier | IfStatement | ImportAttribute | ImportDeclaration | ImportDefaultSpecifier | ImportExpression | ImportNamespaceSpecifier | ImportSpecifier | JSXAttribute | JSXClosingElement | JSXClosingFragment | JSXElement | JSXEmptyExpression | JSXExpressionContainer | JSXFragment | JSXIdentifier | JSXMemberExpression | JSXNamespacedName | JSXOpeningElement | JSXOpeningFragment | JSXSpreadAttribute | JSXSpreadChild | JSXText | LabeledStatement | Literal | LogicalExpression | MemberExpression | MetaProperty | MethodDefinition | NewExpression | ObjectExpression | ObjectPattern | PrivateIdentifier | Program | Property | PropertyDefinition | RestElement | ReturnStatement | SequenceExpression | SpreadElement | StaticBlock | Super | SwitchCase | SwitchStatement | TaggedTemplateExpression | TemplateElement | TemplateLiteral | ThisExpression | ThrowStatement | TryStatement | TSAbstractAccessorProperty | TSAbstractKeyword | TSAbstractMethodDefinition | TSAbstractPropertyDefinition | TSAnyKeyword | TSArrayType | TSAsExpression | TSAsyncKeyword | TSBigIntKeyword | TSBooleanKeyword | TSCallSignatureDeclaration | TSClassImplements | TSConditionalType | TSConstructorType | TSConstructSignatureDeclaration | TSDeclareFunction | TSDeclareKeyword | TSEmptyBodyFunctionExpression | TSEnumBody | TSEnumDeclaration | TSEnumMember | TSExportAssignment | TSExportKeyword | TSExternalModuleReference | TSFunctionType | TSImportEqualsDeclaration | TSImportType | TSIndexedAccessType | TSIndexSignature | TSInferType | TSInstantiationExpression | TSInterfaceBody | TSInterfaceDeclaration | TSInterfaceHeritage | TSIntersectionType | TSIntrinsicKeyword | TSLiteralType | TSMappedType | TSMethodSignature | TSModuleBlock | TSModuleDeclaration | TSNamedTupleMember | TSNamespaceExportDeclaration | TSNeverKeyword | TSNonNullExpression | TSNullKeyword | TSNumberKeyword | TSObjectKeyword | TSOptionalType | TSParameterProperty | TSPrivateKeyword | TSPropertySignature | TSProtectedKeyword | TSPublicKeyword | TSQualifiedName | TSReadonlyKeyword | TSRestType | TSSatisfiesExpression | TSStaticKeyword | TSStringKeyword | TSSymbolKeyword | TSTemplateLiteralType | TSThisType | TSTupleType | TSTypeAliasDeclaration | TSTypeAnnotation | TSTypeAssertion | TSTypeLiteral | TSTypeOperator | TSTypeParameter | TSTypeParameterDeclaration | TSTypeParameterInstantiation | TSTypePredicate | TSTypeQuery | TSTypeReference | TSUndefinedKeyword | TSUnionType | TSUnknownKeyword | TSVoidKeyword | UnaryExpression | UpdateExpression | VariableDeclaration | VariableDeclarator | WhileStatement | WithStatement | YieldExpression;
1280
+ declare interface NodeOrTokenData {
1281
+ type: string;
1282
+ /**
1283
+ * The source location information of the node.
1284
+ *
1285
+ * The loc property is defined as nullable by ESTree, but ESLint requires this property.
1286
+ */
1287
+ loc: SourceLocation;
1288
+ range: Range;
1289
+ }
1290
+ declare interface NullLiteral extends LiteralBase {
1291
+ raw: 'null';
1292
+ value: null;
1293
+ }
1294
+ declare interface NullToken extends BaseToken {
1295
+ type: AST_TOKEN_TYPES.Null;
1296
+ }
1297
+ declare interface NumberLiteral extends LiteralBase {
1298
+ value: number;
1299
+ }
1300
+ declare interface NumericToken extends BaseToken {
1301
+ type: AST_TOKEN_TYPES.Numeric;
1302
+ }
1303
+ declare interface ObjectExpression extends BaseNode {
1304
+ type: AST_NODE_TYPES.ObjectExpression;
1305
+ properties: ObjectLiteralElement[];
1306
+ }
1307
+ declare type ObjectLiteralElement = Property | SpreadElement;
1308
+ declare interface ObjectPattern extends BaseNode {
1309
+ type: AST_NODE_TYPES.ObjectPattern;
1310
+ decorators: Decorator[];
1311
+ optional: boolean;
1312
+ properties: (Property | RestElement)[];
1313
+ typeAnnotation: TSTypeAnnotation | undefined;
1314
+ }
1315
+ declare type Parameter = ArrayPattern | AssignmentPattern | Identifier | ObjectPattern | RestElement | TSParameterProperty;
1316
+ declare interface Position {
1317
+ /**
1318
+ * Column number on the line (0-indexed)
1319
+ */
1320
+ column: number;
1321
+ /**
1322
+ * Line number (1-indexed)
1323
+ */
1324
+ line: number;
1325
+ }
1326
+ declare interface PrivateIdentifier extends BaseNode {
1327
+ type: AST_NODE_TYPES.PrivateIdentifier;
1328
+ name: string;
1329
+ }
1330
+ declare interface PrivateIdentifierToken extends BaseToken {
1331
+ type: AST_TOKEN_TYPES.PrivateIdentifier;
1332
+ }
1333
+ declare interface Program extends NodeOrTokenData {
1334
+ type: AST_NODE_TYPES.Program;
1335
+ body: ProgramStatement[];
1336
+ comments: Comment[] | undefined;
1337
+ sourceType: 'module' | 'script';
1338
+ tokens: Token[] | undefined;
1339
+ }
1340
+ declare type ProgramStatement = ExportAllDeclaration | ExportDefaultDeclaration | ExportNamedDeclaration | ImportDeclaration | Statement | TSImportEqualsDeclaration | TSNamespaceExportDeclaration;
1341
+ declare type Property = PropertyComputedName | PropertyNonComputedName;
1342
+ declare interface PropertyBase extends BaseNode {
1343
+ type: AST_NODE_TYPES.Property;
1344
+ computed: boolean;
1345
+ key: PropertyName;
1346
+ kind: 'get' | 'init' | 'set';
1347
+ method: boolean;
1348
+ optional: boolean;
1349
+ shorthand: boolean;
1350
+ value: AssignmentPattern | BindingName | Expression | TSEmptyBodyFunctionExpression;
1351
+ }
1352
+ declare interface PropertyComputedName extends PropertyBase {
1353
+ computed: true;
1354
+ key: PropertyNameComputed;
1355
+ }
1356
+ declare type PropertyDefinition = PropertyDefinitionComputedName | PropertyDefinitionNonComputedName;
1357
+ declare interface PropertyDefinitionBase extends BaseNode {
1358
+ accessibility: Accessibility | undefined;
1359
+ computed: boolean;
1360
+ declare: boolean;
1361
+ decorators: Decorator[];
1362
+ definite: boolean;
1363
+ key: PropertyName;
1364
+ optional: boolean;
1365
+ override: boolean;
1366
+ readonly: boolean;
1367
+ static: boolean;
1368
+ typeAnnotation: TSTypeAnnotation | undefined;
1369
+ value: Expression | null;
1370
+ }
1371
+ declare interface PropertyDefinitionComputedName extends PropertyDefinitionComputedNameBase {
1372
+ type: AST_NODE_TYPES.PropertyDefinition;
1373
+ }
1374
+ declare interface PropertyDefinitionComputedNameBase extends PropertyDefinitionBase {
1375
+ computed: true;
1376
+ key: PropertyNameComputed;
1377
+ }
1378
+ declare interface PropertyDefinitionNonComputedName extends ClassPropertyDefinitionNonComputedNameBase {
1379
+ type: AST_NODE_TYPES.PropertyDefinition;
1380
+ }
1381
+ declare interface PropertyDefinitionNonComputedNameBase extends PropertyDefinitionBase {
1382
+ computed: false;
1383
+ key: PropertyNameNonComputed;
1384
+ }
1385
+ declare type PropertyName = ClassPropertyNameNonComputed | PropertyNameComputed | PropertyNameNonComputed;
1386
+ declare type PropertyNameComputed = Expression;
1387
+ declare type PropertyNameNonComputed = Identifier | NumberLiteral | StringLiteral;
1388
+ declare interface PropertyNonComputedName extends PropertyBase {
1389
+ computed: false;
1390
+ key: PropertyNameNonComputed;
1391
+ }
1392
+ declare interface PunctuatorToken extends BaseToken {
1393
+ type: AST_TOKEN_TYPES.Punctuator;
1394
+ value: ValueOf<PunctuatorTokenToText>;
1395
+ }
1396
+ declare interface PunctuatorTokenToText extends AssignmentOperatorToText {
1397
+ [SyntaxKind.AmpersandAmpersandToken]: '&&';
1398
+ [SyntaxKind.AmpersandToken]: '&';
1399
+ [SyntaxKind.AsteriskAsteriskToken]: '**';
1400
+ [SyntaxKind.AsteriskToken]: '*';
1401
+ [SyntaxKind.AtToken]: '@';
1402
+ [SyntaxKind.BacktickToken]: '`';
1403
+ [SyntaxKind.BarBarToken]: '||';
1404
+ [SyntaxKind.BarToken]: '|';
1405
+ [SyntaxKind.CaretToken]: '^';
1406
+ [SyntaxKind.CloseBraceToken]: '}';
1407
+ [SyntaxKind.CloseBracketToken]: ']';
1408
+ [SyntaxKind.CloseParenToken]: ')';
1409
+ [SyntaxKind.ColonToken]: ':';
1410
+ [SyntaxKind.CommaToken]: ',';
1411
+ [SyntaxKind.DotDotDotToken]: '...';
1412
+ [SyntaxKind.DotToken]: '.';
1413
+ [SyntaxKind.EqualsEqualsEqualsToken]: '===';
1414
+ [SyntaxKind.EqualsEqualsToken]: '==';
1415
+ [SyntaxKind.EqualsGreaterThanToken]: '=>';
1416
+ [SyntaxKind.ExclamationEqualsEqualsToken]: '!==';
1417
+ [SyntaxKind.ExclamationEqualsToken]: '!=';
1418
+ [SyntaxKind.ExclamationToken]: '!';
1419
+ [SyntaxKind.GreaterThanEqualsToken]: '>=';
1420
+ [SyntaxKind.GreaterThanGreaterThanGreaterThanToken]: '>>>';
1421
+ [SyntaxKind.GreaterThanGreaterThanToken]: '>>';
1422
+ [SyntaxKind.GreaterThanToken]: '>';
1423
+ [SyntaxKind.HashToken]: '#';
1424
+ [SyntaxKind.LessThanEqualsToken]: '<=';
1425
+ [SyntaxKind.LessThanLessThanToken]: '<<';
1426
+ [SyntaxKind.LessThanSlashToken]: '</';
1427
+ [SyntaxKind.LessThanToken]: '<';
1428
+ [SyntaxKind.MinusMinusToken]: '--';
1429
+ [SyntaxKind.MinusToken]: '-';
1430
+ [SyntaxKind.OpenBraceToken]: '{';
1431
+ [SyntaxKind.OpenBracketToken]: '[';
1432
+ [SyntaxKind.OpenParenToken]: '(';
1433
+ [SyntaxKind.PercentToken]: '%';
1434
+ [SyntaxKind.PlusPlusToken]: '++';
1435
+ [SyntaxKind.PlusToken]: '+';
1436
+ [SyntaxKind.QuestionDotToken]: '?.';
1437
+ [SyntaxKind.QuestionQuestionToken]: '??';
1438
+ [SyntaxKind.QuestionToken]: '?';
1439
+ [SyntaxKind.SemicolonToken]: ';';
1440
+ [SyntaxKind.SlashToken]: '/';
1441
+ [SyntaxKind.TildeToken]: '~';
1442
+ }
1443
+ /**
1444
+ * An array of two numbers.
1445
+ * Both numbers are a 0-based index which is the position in the array of source code characters.
1446
+ * The first is the start position of the node, the second is the end position of the node.
1447
+ */
1448
+ declare type Range = [number, number];
1449
+ declare interface RegExpLiteral extends LiteralBase {
1450
+ regex: {
1451
+ flags: string;
1452
+ pattern: string;
1453
+ };
1454
+ value: RegExp | null;
1455
+ }
1456
+ declare interface RegularExpressionToken extends BaseToken {
1457
+ type: AST_TOKEN_TYPES.RegularExpression;
1458
+ regex: {
1459
+ flags: string;
1460
+ pattern: string;
1461
+ };
1462
+ }
1463
+ declare interface RestElement extends BaseNode {
1464
+ type: AST_NODE_TYPES.RestElement;
1465
+ argument: DestructuringPattern;
1466
+ decorators: Decorator[];
1467
+ optional: boolean;
1468
+ typeAnnotation: TSTypeAnnotation | undefined;
1469
+ value: AssignmentPattern | undefined;
1470
+ }
1471
+ declare interface ReturnStatement extends BaseNode {
1472
+ type: AST_NODE_TYPES.ReturnStatement;
1473
+ argument: Expression | null;
1474
+ }
1475
+ declare interface SequenceExpression extends BaseNode {
1476
+ type: AST_NODE_TYPES.SequenceExpression;
1477
+ expressions: Expression[];
1478
+ }
1479
+ declare interface SourceLocation {
1480
+ /**
1481
+ * The position of the first character after the parsed source region
1482
+ */
1483
+ end: Position;
1484
+ /**
1485
+ * The position of the first character of the parsed source region
1486
+ */
1487
+ start: Position;
1488
+ }
1489
+ declare interface SpreadElement extends BaseNode {
1490
+ type: AST_NODE_TYPES.SpreadElement;
1491
+ argument: Expression;
1492
+ }
1493
+ declare type Statement = BlockStatement | BreakStatement | ClassDeclarationWithName | ContinueStatement | DebuggerStatement | DoWhileStatement | EmptyStatement | ExportAllDeclaration | ExportDefaultDeclaration | ExportNamedDeclaration | ExpressionStatement | ForInStatement | ForOfStatement | ForStatement | FunctionDeclarationWithName | IfStatement | ImportDeclaration | LabeledStatement | ReturnStatement | SwitchStatement | ThrowStatement | TryStatement | TSDeclareFunction | TSEnumDeclaration | TSExportAssignment | TSImportEqualsDeclaration | TSInterfaceDeclaration | TSModuleDeclaration | TSNamespaceExportDeclaration | TSTypeAliasDeclaration | VariableDeclaration | WhileStatement | WithStatement;
1494
+ declare interface StaticBlock extends BaseNode {
1495
+ type: AST_NODE_TYPES.StaticBlock;
1496
+ body: Statement[];
1497
+ }
1498
+ declare interface StringLiteral extends LiteralBase {
1499
+ value: string;
1500
+ }
1501
+ declare interface StringToken extends BaseToken {
1502
+ type: AST_TOKEN_TYPES.String;
1503
+ }
1504
+ declare interface Super extends BaseNode {
1505
+ type: AST_NODE_TYPES.Super;
1506
+ }
1507
+ declare interface SwitchCase extends BaseNode {
1508
+ type: AST_NODE_TYPES.SwitchCase;
1509
+ consequent: Statement[];
1510
+ test: Expression | null;
1511
+ }
1512
+ declare interface SwitchStatement extends BaseNode {
1513
+ type: AST_NODE_TYPES.SwitchStatement;
1514
+ cases: SwitchCase[];
1515
+ discriminant: Expression;
1516
+ }
1517
+ declare interface TaggedTemplateExpression extends BaseNode {
1518
+ type: AST_NODE_TYPES.TaggedTemplateExpression;
1519
+ quasi: TemplateLiteral;
1520
+ tag: Expression;
1521
+ typeArguments: TSTypeParameterInstantiation | undefined;
1522
+ }
1523
+ declare interface TemplateElement extends BaseNode {
1524
+ type: AST_NODE_TYPES.TemplateElement;
1525
+ tail: boolean;
1526
+ value: {
1527
+ cooked: string;
1528
+ raw: string;
1529
+ };
1530
+ }
1531
+ declare interface TemplateLiteral extends BaseNode {
1532
+ type: AST_NODE_TYPES.TemplateLiteral;
1533
+ expressions: Expression[];
1534
+ quasis: TemplateElement[];
1535
+ }
1536
+ declare interface TemplateToken extends BaseToken {
1537
+ type: AST_TOKEN_TYPES.Template;
1538
+ }
1539
+ declare interface ThisExpression extends BaseNode {
1540
+ type: AST_NODE_TYPES.ThisExpression;
1541
+ }
1542
+ declare interface ThrowStatement extends BaseNode {
1543
+ type: AST_NODE_TYPES.ThrowStatement;
1544
+ argument: Expression;
1545
+ }
1546
+ declare type Token = BooleanToken | Comment | IdentifierToken | JSXIdentifierToken | JSXTextToken | KeywordToken | NullToken | NumericToken | PrivateIdentifierToken | PunctuatorToken | RegularExpressionToken | StringToken | TemplateToken;
1547
+ declare interface TryStatement extends BaseNode {
1548
+ type: AST_NODE_TYPES.TryStatement;
1549
+ block: BlockStatement;
1550
+ finalizer: BlockStatement | null;
1551
+ handler: CatchClause | null;
1552
+ }
1553
+ declare type TSAbstractAccessorProperty = TSAbstractAccessorPropertyComputedName | TSAbstractAccessorPropertyNonComputedName;
1554
+ declare interface TSAbstractAccessorPropertyComputedName extends PropertyDefinitionComputedNameBase {
1555
+ type: AST_NODE_TYPES.TSAbstractAccessorProperty;
1556
+ value: null;
1557
+ }
1558
+ declare interface TSAbstractAccessorPropertyNonComputedName extends PropertyDefinitionNonComputedNameBase {
1559
+ type: AST_NODE_TYPES.TSAbstractAccessorProperty;
1560
+ value: null;
1561
+ }
1562
+ declare interface TSAbstractKeyword extends BaseNode {
1563
+ type: AST_NODE_TYPES.TSAbstractKeyword;
1564
+ }
1565
+ declare type TSAbstractMethodDefinition = TSAbstractMethodDefinitionComputedName | TSAbstractMethodDefinitionNonComputedName;
1566
+ declare interface TSAbstractMethodDefinitionComputedName extends MethodDefinitionComputedNameBase {
1567
+ type: AST_NODE_TYPES.TSAbstractMethodDefinition;
1568
+ }
1569
+ declare interface TSAbstractMethodDefinitionNonComputedName extends MethodDefinitionNonComputedNameBase {
1570
+ type: AST_NODE_TYPES.TSAbstractMethodDefinition;
1571
+ }
1572
+ declare type TSAbstractPropertyDefinition = TSAbstractPropertyDefinitionComputedName | TSAbstractPropertyDefinitionNonComputedName;
1573
+ declare interface TSAbstractPropertyDefinitionComputedName extends PropertyDefinitionComputedNameBase {
1574
+ type: AST_NODE_TYPES.TSAbstractPropertyDefinition;
1575
+ value: null;
1576
+ }
1577
+ declare interface TSAbstractPropertyDefinitionNonComputedName extends PropertyDefinitionNonComputedNameBase {
1578
+ type: AST_NODE_TYPES.TSAbstractPropertyDefinition;
1579
+ value: null;
1580
+ }
1581
+ declare interface TSAnyKeyword extends BaseNode {
1582
+ type: AST_NODE_TYPES.TSAnyKeyword;
1583
+ }
1584
+ declare interface TSArrayType extends BaseNode {
1585
+ type: AST_NODE_TYPES.TSArrayType;
1586
+ elementType: TypeNode;
1587
+ }
1588
+ declare interface TSAsExpression extends BaseNode {
1589
+ type: AST_NODE_TYPES.TSAsExpression;
1590
+ expression: Expression;
1591
+ typeAnnotation: TypeNode;
1592
+ }
1593
+ declare interface TSAsyncKeyword extends BaseNode {
1594
+ type: AST_NODE_TYPES.TSAsyncKeyword;
1595
+ }
1596
+ declare interface TSBigIntKeyword extends BaseNode {
1597
+ type: AST_NODE_TYPES.TSBigIntKeyword;
1598
+ }
1599
+ declare interface TSBooleanKeyword extends BaseNode {
1600
+ type: AST_NODE_TYPES.TSBooleanKeyword;
1601
+ }
1602
+ declare interface TSCallSignatureDeclaration extends TSFunctionSignatureBase {
1603
+ type: AST_NODE_TYPES.TSCallSignatureDeclaration;
1604
+ }
1605
+ declare interface TSClassImplements extends TSHeritageBase {
1606
+ type: AST_NODE_TYPES.TSClassImplements;
1607
+ }
1608
+ declare interface TSConditionalType extends BaseNode {
1609
+ type: AST_NODE_TYPES.TSConditionalType;
1610
+ checkType: TypeNode;
1611
+ extendsType: TypeNode;
1612
+ falseType: TypeNode;
1613
+ trueType: TypeNode;
1614
+ }
1615
+ declare interface TSConstructorType extends TSFunctionSignatureBase {
1616
+ type: AST_NODE_TYPES.TSConstructorType;
1617
+ abstract: boolean;
1618
+ }
1619
+ declare interface TSConstructSignatureDeclaration extends TSFunctionSignatureBase {
1620
+ type: AST_NODE_TYPES.TSConstructSignatureDeclaration;
1621
+ }
1622
+ declare type TSDeclareFunction = TSDeclareFunctionNoDeclare | TSDeclareFunctionWithDeclare;
1623
+ declare interface TSDeclareFunctionBase extends FunctionBase {
1624
+ type: AST_NODE_TYPES.TSDeclareFunction;
1625
+ /**
1626
+ * TS1183: An implementation cannot be declared in ambient contexts.
1627
+ */
1628
+ body: undefined;
1629
+ /**
1630
+ * Whether the declaration has `declare` modifier.
1631
+ */
1632
+ declare: boolean;
1633
+ expression: false;
1634
+ }
1635
+ /**
1636
+ * Function declaration without the `declare` keyword:
1637
+ * ```
1638
+ * function foo(): void;
1639
+ * ```
1640
+ * This can either be an overload signature or a declaration in an ambient context
1641
+ * (e.g. `declare module`)
1642
+ */
1643
+ declare interface TSDeclareFunctionNoDeclare extends TSDeclareFunctionBase {
1644
+ declare: false;
1645
+ /**
1646
+ * - TS1221: Generators are not allowed in an ambient context.
1647
+ * - TS1222: An overload signature cannot be declared as a generator.
1648
+ */
1649
+ generator: false;
1650
+ }
1651
+ /**
1652
+ * Function declaration with the `declare` keyword:
1653
+ * ```
1654
+ * declare function foo(): void;
1655
+ * ```
1656
+ */
1657
+ declare interface TSDeclareFunctionWithDeclare extends TSDeclareFunctionBase {
1658
+ /**
1659
+ * TS1040: 'async' modifier cannot be used in an ambient context.
1660
+ */
1661
+ async: false;
1662
+ declare: true;
1663
+ /**
1664
+ * TS1221: Generators are not allowed in an ambient context.
1665
+ */
1666
+ generator: false;
1667
+ }
1668
+ declare interface TSDeclareKeyword extends BaseNode {
1669
+ type: AST_NODE_TYPES.TSDeclareKeyword;
1670
+ }
1671
+ declare interface TSEmptyBodyFunctionExpression extends FunctionBase {
1672
+ type: AST_NODE_TYPES.TSEmptyBodyFunctionExpression;
1673
+ body: null;
1674
+ id: null;
1675
+ }
1676
+ declare interface TSEnumBody extends BaseNode {
1677
+ type: AST_NODE_TYPES.TSEnumBody;
1678
+ members: TSEnumMember[];
1679
+ }
1680
+ declare interface TSEnumDeclaration extends BaseNode {
1681
+ type: AST_NODE_TYPES.TSEnumDeclaration;
1682
+ /**
1683
+ * The body of the enum.
1684
+ */
1685
+ body: TSEnumBody;
1686
+ /**
1687
+ * Whether this is a `const` enum.
1688
+ * @example
1689
+ * ```ts
1690
+ * const enum Foo {}
1691
+ * ```
1692
+ */
1693
+ const: boolean;
1694
+ /**
1695
+ * Whether this is a `declare`d enum.
1696
+ * @example
1697
+ * ```ts
1698
+ * declare enum Foo {}
1699
+ * ```
1700
+ */
1701
+ declare: boolean;
1702
+ /**
1703
+ * The enum name.
1704
+ */
1705
+ id: Identifier;
1706
+ /**
1707
+ * The enum members.
1708
+ * @deprecated Use {@link body} instead.
1709
+ */
1710
+ members: TSEnumMember[];
1711
+ }
1712
+ declare type TSEnumMember = TSEnumMemberComputedName | TSEnumMemberNonComputedName;
1713
+ declare interface TSEnumMemberBase extends BaseNode {
1714
+ type: AST_NODE_TYPES.TSEnumMember;
1715
+ computed: boolean;
1716
+ id: PropertyNameComputed | PropertyNameNonComputed;
1717
+ initializer: Expression | undefined;
1718
+ }
1719
+ /**
1720
+ * this should only really happen in semantically invalid code (errors 1164 and 2452)
1721
+ *
1722
+ * @example
1723
+ * ```ts
1724
+ * // VALID:
1725
+ * enum Foo { ['a'] }
1726
+ *
1727
+ * // INVALID:
1728
+ * const x = 'a';
1729
+ * enum Foo { [x] }
1730
+ * enum Bar { ['a' + 'b'] }
1731
+ * ```
1732
+ */
1733
+ declare interface TSEnumMemberComputedName extends TSEnumMemberBase {
1734
+ computed: true;
1735
+ id: PropertyNameComputed;
1736
+ }
1737
+ declare interface TSEnumMemberNonComputedName extends TSEnumMemberBase {
1738
+ computed: false;
1739
+ id: PropertyNameNonComputed;
1740
+ }
1741
+ declare interface TSExportAssignment extends BaseNode {
1742
+ type: AST_NODE_TYPES.TSExportAssignment;
1743
+ expression: Expression;
1744
+ }
1745
+ declare interface TSExportKeyword extends BaseNode {
1746
+ type: AST_NODE_TYPES.TSExportKeyword;
1747
+ }
1748
+ declare interface TSExternalModuleReference extends BaseNode {
1749
+ type: AST_NODE_TYPES.TSExternalModuleReference;
1750
+ expression: StringLiteral;
1751
+ }
1752
+ declare interface TSFunctionSignatureBase extends BaseNode {
1753
+ params: Parameter[];
1754
+ returnType: TSTypeAnnotation | undefined;
1755
+ typeParameters: TSTypeParameterDeclaration | undefined;
1756
+ }
1757
+ declare interface TSFunctionType extends TSFunctionSignatureBase {
1758
+ type: AST_NODE_TYPES.TSFunctionType;
1759
+ }
1760
+ declare interface TSHeritageBase extends BaseNode {
1761
+ expression: Expression;
1762
+ typeArguments: TSTypeParameterInstantiation | undefined;
1763
+ }
1764
+ declare type TSImportEqualsDeclaration = TSImportEqualsNamespaceDeclaration | TSImportEqualsRequireDeclaration;
1765
+ declare interface TSImportEqualsDeclarationBase extends BaseNode {
1766
+ type: AST_NODE_TYPES.TSImportEqualsDeclaration;
1767
+ /**
1768
+ * The locally imported name.
1769
+ */
1770
+ id: Identifier;
1771
+ /**
1772
+ * The kind of the import. Always `'value'` unless `moduleReference` is a
1773
+ * `TSExternalModuleReference`.
1774
+ */
1775
+ importKind: ImportKind;
1776
+ /**
1777
+ * The value being aliased.
1778
+ * @example
1779
+ * ```ts
1780
+ * import F1 = A;
1781
+ * import F2 = A.B.C;
1782
+ * import F3 = require('mod');
1783
+ * ```
1784
+ */
1785
+ moduleReference: Identifier | TSExternalModuleReference | TSQualifiedName;
1786
+ }
1787
+ declare interface TSImportEqualsNamespaceDeclaration extends TSImportEqualsDeclarationBase {
1788
+ /**
1789
+ * The kind of the import.
1790
+ */
1791
+ importKind: 'value';
1792
+ /**
1793
+ * The value being aliased.
1794
+ * ```
1795
+ * import F1 = A;
1796
+ * import F2 = A.B.C;
1797
+ * ```
1798
+ */
1799
+ moduleReference: Identifier | TSQualifiedName;
1800
+ }
1801
+ declare interface TSImportEqualsRequireDeclaration extends TSImportEqualsDeclarationBase {
1802
+ /**
1803
+ * The kind of the import.
1804
+ */
1805
+ importKind: ImportKind;
1806
+ /**
1807
+ * The value being aliased.
1808
+ * ```
1809
+ * import F3 = require('mod');
1810
+ * ```
1811
+ */
1812
+ moduleReference: TSExternalModuleReference;
1813
+ }
1814
+ declare interface TSImportType extends BaseNode {
1815
+ type: AST_NODE_TYPES.TSImportType;
1816
+ argument: TypeNode;
1817
+ options: ObjectExpression | null;
1818
+ qualifier: EntityName | null;
1819
+ typeArguments: TSTypeParameterInstantiation | null;
1820
+ }
1821
+ declare interface TSIndexedAccessType extends BaseNode {
1822
+ type: AST_NODE_TYPES.TSIndexedAccessType;
1823
+ indexType: TypeNode;
1824
+ objectType: TypeNode;
1825
+ }
1826
+ declare interface TSIndexSignature extends BaseNode {
1827
+ type: AST_NODE_TYPES.TSIndexSignature;
1828
+ accessibility: Accessibility | undefined;
1829
+ parameters: Parameter[];
1830
+ readonly: boolean;
1831
+ static: boolean;
1832
+ typeAnnotation: TSTypeAnnotation | undefined;
1833
+ }
1834
+ declare interface TSInferType extends BaseNode {
1835
+ type: AST_NODE_TYPES.TSInferType;
1836
+ typeParameter: TSTypeParameter;
1837
+ }
1838
+ declare interface TSInstantiationExpression extends BaseNode {
1839
+ type: AST_NODE_TYPES.TSInstantiationExpression;
1840
+ expression: Expression;
1841
+ typeArguments: TSTypeParameterInstantiation;
1842
+ }
1843
+ declare interface TSInterfaceBody extends BaseNode {
1844
+ type: AST_NODE_TYPES.TSInterfaceBody;
1845
+ body: TypeElement[];
1846
+ }
1847
+ declare interface TSInterfaceDeclaration extends BaseNode {
1848
+ type: AST_NODE_TYPES.TSInterfaceDeclaration;
1849
+ /**
1850
+ * The body of the interface
1851
+ */
1852
+ body: TSInterfaceBody;
1853
+ /**
1854
+ * Whether the interface was `declare`d
1855
+ */
1856
+ declare: boolean;
1857
+ /**
1858
+ * The types this interface `extends`
1859
+ */
1860
+ extends: TSInterfaceHeritage[];
1861
+ /**
1862
+ * The name of this interface
1863
+ */
1864
+ id: Identifier;
1865
+ /**
1866
+ * The generic type parameters declared for the interface. Empty declaration
1867
+ * (`<>`) is different from no declaration.
1868
+ */
1869
+ typeParameters: TSTypeParameterDeclaration | undefined;
1870
+ }
1871
+ declare interface TSInterfaceHeritage extends TSHeritageBase {
1872
+ type: AST_NODE_TYPES.TSInterfaceHeritage;
1873
+ }
1874
+ declare interface TSIntersectionType extends BaseNode {
1875
+ type: AST_NODE_TYPES.TSIntersectionType;
1876
+ types: TypeNode[];
1877
+ }
1878
+ declare interface TSIntrinsicKeyword extends BaseNode {
1879
+ type: AST_NODE_TYPES.TSIntrinsicKeyword;
1880
+ }
1881
+ declare interface TSLiteralType extends BaseNode {
1882
+ type: AST_NODE_TYPES.TSLiteralType;
1883
+ literal: LiteralExpression | UnaryExpression | UpdateExpression;
1884
+ }
1885
+ declare interface TSMappedType extends BaseNode {
1886
+ type: AST_NODE_TYPES.TSMappedType;
1887
+ constraint: TypeNode;
1888
+ key: Identifier;
1889
+ nameType: TypeNode | null;
1890
+ optional: boolean | '+' | '-' | undefined;
1891
+ readonly: boolean | '+' | '-' | undefined;
1892
+ typeAnnotation: TypeNode | undefined;
1893
+ /** @deprecated Use {@link `constraint`} and {@link `key`} instead. */
1894
+ typeParameter: TSTypeParameter;
1895
+ }
1896
+ declare type TSMethodSignature = TSMethodSignatureComputedName | TSMethodSignatureNonComputedName;
1897
+ declare interface TSMethodSignatureBase extends BaseNode {
1898
+ type: AST_NODE_TYPES.TSMethodSignature;
1899
+ accessibility: Accessibility | undefined;
1900
+ computed: boolean;
1901
+ key: PropertyName;
1902
+ kind: 'get' | 'method' | 'set';
1903
+ optional: boolean;
1904
+ params: Parameter[];
1905
+ readonly: boolean;
1906
+ returnType: TSTypeAnnotation | undefined;
1907
+ static: boolean;
1908
+ typeParameters: TSTypeParameterDeclaration | undefined;
1909
+ }
1910
+ declare interface TSMethodSignatureComputedName extends TSMethodSignatureBase {
1911
+ computed: true;
1912
+ key: PropertyNameComputed;
1913
+ }
1914
+ declare interface TSMethodSignatureNonComputedName extends TSMethodSignatureBase {
1915
+ computed: false;
1916
+ key: PropertyNameNonComputed;
1917
+ }
1918
+ declare interface TSModuleBlock extends BaseNode {
1919
+ type: AST_NODE_TYPES.TSModuleBlock;
1920
+ body: ProgramStatement[];
1921
+ }
1922
+ declare type TSModuleDeclaration = TSModuleDeclarationGlobal | TSModuleDeclarationModule | TSModuleDeclarationNamespace;
1923
+ declare interface TSModuleDeclarationBase extends BaseNode {
1924
+ type: AST_NODE_TYPES.TSModuleDeclaration;
1925
+ /**
1926
+ * The body of the module.
1927
+ * This can only be `undefined` for the code `declare module 'mod';`
1928
+ */
1929
+ body?: TSModuleBlock;
1930
+ /**
1931
+ * Whether the module is `declare`d
1932
+ * @example
1933
+ * ```ts
1934
+ * declare namespace F {}
1935
+ * ```
1936
+ */
1937
+ declare: boolean;
1938
+ /**
1939
+ * Whether this is a global declaration
1940
+ * @example
1941
+ * ```ts
1942
+ * declare global {}
1943
+ * ```
1944
+ *
1945
+ * @deprecated Use {@link kind} instead
1946
+ */
1947
+ global: boolean;
1948
+ /**
1949
+ * The name of the module
1950
+ * ```
1951
+ * namespace A {}
1952
+ * namespace A.B.C {}
1953
+ * module 'a' {}
1954
+ * ```
1955
+ */
1956
+ id: Identifier | Literal | TSQualifiedName;
1957
+ /**
1958
+ * The keyword used to define this module declaration
1959
+ * @example
1960
+ * ```ts
1961
+ * namespace Foo {}
1962
+ * ^^^^^^^^^
1963
+ *
1964
+ * module 'foo' {}
1965
+ * ^^^^^^
1966
+ *
1967
+ * global {}
1968
+ * ^^^^^^
1969
+ * ```
1970
+ */
1971
+ kind: TSModuleDeclarationKind;
1972
+ }
1973
+ declare interface TSModuleDeclarationGlobal extends TSModuleDeclarationBase {
1974
+ body: TSModuleBlock;
1975
+ /**
1976
+ * This will always be an Identifier with name `global`
1977
+ */
1978
+ id: Identifier;
1979
+ kind: 'global';
1980
+ }
1981
+ declare type TSModuleDeclarationKind = 'global' | 'module' | 'namespace';
1982
+ declare type TSModuleDeclarationModule = TSModuleDeclarationModuleWithIdentifierId | TSModuleDeclarationModuleWithStringId;
1983
+ declare interface TSModuleDeclarationModuleBase extends TSModuleDeclarationBase {
1984
+ kind: 'module';
1985
+ }
1986
+ /**
1987
+ * The legacy module declaration, replaced with namespace declarations.
1988
+ * ```
1989
+ * module A {}
1990
+ * ```
1991
+ */
1992
+ declare interface TSModuleDeclarationModuleWithIdentifierId extends TSModuleDeclarationModuleBase {
1993
+ body: TSModuleBlock;
1994
+ id: Identifier;
1995
+ kind: 'module';
1996
+ }
1997
+ declare type TSModuleDeclarationModuleWithStringId = TSModuleDeclarationModuleWithStringIdDeclared | TSModuleDeclarationModuleWithStringIdNotDeclared;
1998
+ /**
1999
+ * A string module declaration that is declared:
2000
+ * ```
2001
+ * declare module 'foo' {}
2002
+ * declare module 'foo';
2003
+ * ```
2004
+ */
2005
+ declare interface TSModuleDeclarationModuleWithStringIdDeclared extends TSModuleDeclarationModuleBase {
2006
+ body?: TSModuleBlock;
2007
+ declare: true;
2008
+ id: StringLiteral;
2009
+ kind: 'module';
2010
+ }
2011
+ /**
2012
+ * A string module declaration that is not declared:
2013
+ * ```
2014
+ * module 'foo' {}
2015
+ * ```
2016
+ */
2017
+ declare interface TSModuleDeclarationModuleWithStringIdNotDeclared extends TSModuleDeclarationModuleBase {
2018
+ body: TSModuleBlock;
2019
+ declare: false;
2020
+ id: StringLiteral;
2021
+ kind: 'module';
2022
+ }
2023
+ declare interface TSModuleDeclarationNamespace extends TSModuleDeclarationBase {
2024
+ body: TSModuleBlock;
2025
+ id: Identifier | TSQualifiedName;
2026
+ kind: 'namespace';
2027
+ }
2028
+ declare interface TSNamedTupleMember extends BaseNode {
2029
+ type: AST_NODE_TYPES.TSNamedTupleMember;
2030
+ elementType: TypeNode;
2031
+ label: Identifier;
2032
+ optional: boolean;
2033
+ }
2034
+ /**
2035
+ * For the following declaration:
2036
+ * ```
2037
+ * export as namespace X;
2038
+ * ```
2039
+ */
2040
+ declare interface TSNamespaceExportDeclaration extends BaseNode {
2041
+ type: AST_NODE_TYPES.TSNamespaceExportDeclaration;
2042
+ /**
2043
+ * The name of the global variable that's exported as namespace
2044
+ */
2045
+ id: Identifier;
2046
+ }
2047
+ declare interface TSNeverKeyword extends BaseNode {
2048
+ type: AST_NODE_TYPES.TSNeverKeyword;
2049
+ }
2050
+ declare interface TSNonNullExpression extends BaseNode {
2051
+ type: AST_NODE_TYPES.TSNonNullExpression;
2052
+ expression: Expression;
2053
+ }
2054
+ declare interface TSNullKeyword extends BaseNode {
2055
+ type: AST_NODE_TYPES.TSNullKeyword;
2056
+ }
2057
+ declare interface TSNumberKeyword extends BaseNode {
2058
+ type: AST_NODE_TYPES.TSNumberKeyword;
2059
+ }
2060
+ declare interface TSObjectKeyword extends BaseNode {
2061
+ type: AST_NODE_TYPES.TSObjectKeyword;
2062
+ }
2063
+ declare interface TSOptionalType extends BaseNode {
2064
+ type: AST_NODE_TYPES.TSOptionalType;
2065
+ typeAnnotation: TypeNode;
2066
+ }
2067
+ declare interface TSParameterProperty extends BaseNode {
2068
+ type: AST_NODE_TYPES.TSParameterProperty;
2069
+ accessibility: Accessibility | undefined;
2070
+ decorators: Decorator[];
2071
+ override: boolean;
2072
+ parameter: AssignmentPattern | BindingName | RestElement;
2073
+ readonly: boolean;
2074
+ static: boolean;
2075
+ }
2076
+ declare interface TSPrivateKeyword extends BaseNode {
2077
+ type: AST_NODE_TYPES.TSPrivateKeyword;
2078
+ }
2079
+ declare type TSPropertySignature = TSPropertySignatureComputedName | TSPropertySignatureNonComputedName;
2080
+ declare interface TSPropertySignatureBase extends BaseNode {
2081
+ type: AST_NODE_TYPES.TSPropertySignature;
2082
+ accessibility: Accessibility | undefined;
2083
+ computed: boolean;
2084
+ key: PropertyName;
2085
+ optional: boolean;
2086
+ readonly: boolean;
2087
+ static: boolean;
2088
+ typeAnnotation: TSTypeAnnotation | undefined;
2089
+ }
2090
+ declare interface TSPropertySignatureComputedName extends TSPropertySignatureBase {
2091
+ computed: true;
2092
+ key: PropertyNameComputed;
2093
+ }
2094
+ declare interface TSPropertySignatureNonComputedName extends TSPropertySignatureBase {
2095
+ computed: false;
2096
+ key: PropertyNameNonComputed;
2097
+ }
2098
+ declare interface TSProtectedKeyword extends BaseNode {
2099
+ type: AST_NODE_TYPES.TSProtectedKeyword;
2100
+ }
2101
+ declare interface TSPublicKeyword extends BaseNode {
2102
+ type: AST_NODE_TYPES.TSPublicKeyword;
2103
+ }
2104
+ declare interface TSQualifiedName extends BaseNode {
2105
+ type: AST_NODE_TYPES.TSQualifiedName;
2106
+ left: EntityName;
2107
+ right: Identifier;
2108
+ }
2109
+ declare interface TSReadonlyKeyword extends BaseNode {
2110
+ type: AST_NODE_TYPES.TSReadonlyKeyword;
2111
+ }
2112
+ declare interface TSRestType extends BaseNode {
2113
+ type: AST_NODE_TYPES.TSRestType;
2114
+ typeAnnotation: TypeNode;
2115
+ }
2116
+ declare interface TSSatisfiesExpression extends BaseNode {
2117
+ type: AST_NODE_TYPES.TSSatisfiesExpression;
2118
+ expression: Expression;
2119
+ typeAnnotation: TypeNode;
2120
+ }
2121
+ declare interface TSStaticKeyword extends BaseNode {
2122
+ type: AST_NODE_TYPES.TSStaticKeyword;
2123
+ }
2124
+ declare interface TSStringKeyword extends BaseNode {
2125
+ type: AST_NODE_TYPES.TSStringKeyword;
2126
+ }
2127
+ declare interface TSSymbolKeyword extends BaseNode {
2128
+ type: AST_NODE_TYPES.TSSymbolKeyword;
2129
+ }
2130
+ declare interface TSTemplateLiteralType extends BaseNode {
2131
+ type: AST_NODE_TYPES.TSTemplateLiteralType;
2132
+ quasis: TemplateElement[];
2133
+ types: TypeNode[];
2134
+ }
2135
+ declare interface TSThisType extends BaseNode {
2136
+ type: AST_NODE_TYPES.TSThisType;
2137
+ }
2138
+ declare interface TSTupleType extends BaseNode {
2139
+ type: AST_NODE_TYPES.TSTupleType;
2140
+ elementTypes: TypeNode[];
2141
+ }
2142
+ declare interface TSTypeAliasDeclaration extends BaseNode {
2143
+ type: AST_NODE_TYPES.TSTypeAliasDeclaration;
2144
+ /**
2145
+ * Whether the type was `declare`d.
2146
+ * @example
2147
+ * ```ts
2148
+ * declare type T = 1;
2149
+ * ```
2150
+ */
2151
+ declare: boolean;
2152
+ /**
2153
+ * The name of the type.
2154
+ */
2155
+ id: Identifier;
2156
+ /**
2157
+ * The "value" (type) of the declaration
2158
+ */
2159
+ typeAnnotation: TypeNode;
2160
+ /**
2161
+ * The generic type parameters declared for the type. Empty declaration
2162
+ * (`<>`) is different from no declaration.
2163
+ */
2164
+ typeParameters: TSTypeParameterDeclaration | undefined;
2165
+ }
2166
+ declare interface TSTypeAnnotation extends BaseNode {
2167
+ type: AST_NODE_TYPES.TSTypeAnnotation;
2168
+ typeAnnotation: TypeNode;
2169
+ }
2170
+ declare interface TSTypeAssertion extends BaseNode {
2171
+ type: AST_NODE_TYPES.TSTypeAssertion;
2172
+ expression: Expression;
2173
+ typeAnnotation: TypeNode;
2174
+ }
2175
+ declare interface TSTypeLiteral extends BaseNode {
2176
+ type: AST_NODE_TYPES.TSTypeLiteral;
2177
+ members: TypeElement[];
2178
+ }
2179
+ declare interface TSTypeOperator extends BaseNode {
2180
+ type: AST_NODE_TYPES.TSTypeOperator;
2181
+ operator: 'keyof' | 'readonly' | 'unique';
2182
+ typeAnnotation: TypeNode | undefined;
2183
+ }
2184
+ declare interface TSTypeParameter extends BaseNode {
2185
+ type: AST_NODE_TYPES.TSTypeParameter;
2186
+ const: boolean;
2187
+ constraint: TypeNode | undefined;
2188
+ default: TypeNode | undefined;
2189
+ in: boolean;
2190
+ name: Identifier;
2191
+ out: boolean;
2192
+ }
2193
+ declare interface TSTypeParameterDeclaration extends BaseNode {
2194
+ type: AST_NODE_TYPES.TSTypeParameterDeclaration;
2195
+ params: TSTypeParameter[];
2196
+ }
2197
+ declare interface TSTypeParameterInstantiation extends BaseNode {
2198
+ type: AST_NODE_TYPES.TSTypeParameterInstantiation;
2199
+ params: TypeNode[];
2200
+ }
2201
+ declare interface TSTypePredicate extends BaseNode {
2202
+ type: AST_NODE_TYPES.TSTypePredicate;
2203
+ asserts: boolean;
2204
+ parameterName: Identifier | TSThisType;
2205
+ typeAnnotation: TSTypeAnnotation | null;
2206
+ }
2207
+ declare interface TSTypeQuery extends BaseNode {
2208
+ type: AST_NODE_TYPES.TSTypeQuery;
2209
+ exprName: EntityName | TSImportType;
2210
+ typeArguments: TSTypeParameterInstantiation | undefined;
2211
+ }
2212
+ declare interface TSTypeReference extends BaseNode {
2213
+ type: AST_NODE_TYPES.TSTypeReference;
2214
+ typeArguments: TSTypeParameterInstantiation | undefined;
2215
+ typeName: EntityName;
2216
+ }
2217
+ declare interface TSUndefinedKeyword extends BaseNode {
2218
+ type: AST_NODE_TYPES.TSUndefinedKeyword;
2219
+ }
2220
+ declare interface TSUnionType extends BaseNode {
2221
+ type: AST_NODE_TYPES.TSUnionType;
2222
+ types: TypeNode[];
2223
+ }
2224
+ declare interface TSUnknownKeyword extends BaseNode {
2225
+ type: AST_NODE_TYPES.TSUnknownKeyword;
2226
+ }
2227
+ declare interface TSVoidKeyword extends BaseNode {
2228
+ type: AST_NODE_TYPES.TSVoidKeyword;
2229
+ }
2230
+ declare type TypeElement = TSCallSignatureDeclaration | TSConstructSignatureDeclaration | TSIndexSignature | TSMethodSignature | TSPropertySignature;
2231
+ declare type TypeNode = TSAbstractKeyword | TSAnyKeyword | TSArrayType | TSAsyncKeyword | TSBigIntKeyword | TSBooleanKeyword | TSConditionalType | TSConstructorType | TSDeclareKeyword | TSExportKeyword | TSFunctionType | TSImportType | TSIndexedAccessType | TSInferType | TSIntersectionType | TSIntrinsicKeyword | TSLiteralType | TSMappedType | TSNamedTupleMember | TSNeverKeyword | TSNullKeyword | TSNumberKeyword | TSObjectKeyword | TSOptionalType | TSPrivateKeyword | TSProtectedKeyword | TSPublicKeyword | TSQualifiedName | TSReadonlyKeyword | TSRestType | TSStaticKeyword | TSStringKeyword | TSSymbolKeyword | TSTemplateLiteralType | TSThisType | TSTupleType | TSTypeLiteral | TSTypeOperator | TSTypePredicate | TSTypeQuery | TSTypeReference | TSUndefinedKeyword | TSUnionType | TSUnknownKeyword | TSVoidKeyword;
2232
+ declare interface UnaryExpression extends UnaryExpressionBase {
2233
+ type: AST_NODE_TYPES.UnaryExpression;
2234
+ operator: '!' | '+' | '~' | '-' | 'delete' | 'typeof' | 'void';
2235
+ }
2236
+ declare interface UnaryExpressionBase extends BaseNode {
2237
+ argument: Expression;
2238
+ operator: string;
2239
+ prefix: boolean;
2240
+ }
2241
+ declare interface UpdateExpression extends UnaryExpressionBase {
2242
+ type: AST_NODE_TYPES.UpdateExpression;
2243
+ operator: '++' | '--';
2244
+ }
2245
+ declare type UsingDeclaration = UsingInForOfDeclaration | UsingInNormalContextDeclaration;
2246
+ declare interface UsingDeclarationBase extends BaseNode {
2247
+ type: AST_NODE_TYPES.VariableDeclaration;
2248
+ /**
2249
+ * This value will always be `false`
2250
+ * because 'declare' modifier cannot appear on a 'using' declaration.
2251
+ */
2252
+ declare: false;
2253
+ /**
2254
+ * The keyword used to declare the variable(s)
2255
+ * @example
2256
+ * ```ts
2257
+ * using x = 1;
2258
+ * await using y = 2;
2259
+ * ```
2260
+ */
2261
+ kind: 'await using' | 'using';
2262
+ }
2263
+ declare type UsingDeclarator = UsingInForOfDeclarator | UsingInNormalContextDeclarator;
2264
+ declare interface UsingInForOfDeclaration extends UsingDeclarationBase {
2265
+ /**
2266
+ * The variables declared by this declaration.
2267
+ * Always has exactly one element.
2268
+ * @example
2269
+ * ```ts
2270
+ * for (using x of y) {}
2271
+ * ```
2272
+ */
2273
+ declarations: [UsingInForOfDeclarator];
2274
+ }
2275
+ declare interface UsingInForOfDeclarator extends VariableDeclaratorBase {
2276
+ definite: false;
2277
+ id: Identifier;
2278
+ init: null;
2279
+ }
2280
+ declare interface UsingInNormalContextDeclaration extends UsingDeclarationBase {
2281
+ /**
2282
+ * The variables declared by this declaration.
2283
+ * Always non-empty.
2284
+ * @example
2285
+ * ```ts
2286
+ * using x = 1;
2287
+ * using y = 1, z = 2;
2288
+ * ```
2289
+ */
2290
+ declarations: UsingInNormalContextDeclarator[];
2291
+ }
2292
+ declare interface UsingInNormalContextDeclarator extends VariableDeclaratorBase {
2293
+ definite: false;
2294
+ id: Identifier;
2295
+ init: Expression;
2296
+ }
2297
+ declare type ValueOf<T> = T[keyof T];
2298
+ declare type VariableDeclaration = LetOrConstOrVarDeclaration | UsingDeclaration;
2299
+ declare type VariableDeclarator = LetOrConstOrVarDeclarator | UsingDeclarator;
2300
+ declare interface VariableDeclaratorBase extends BaseNode {
2301
+ type: AST_NODE_TYPES.VariableDeclarator;
2302
+ /**
2303
+ * Whether there's definite assignment assertion (`let x!: number`).
2304
+ * If `true`, then: `id` must be an identifier with a type annotation,
2305
+ * `init` must be `null`, and the declarator must be a `var`/`let` declarator.
2306
+ */
2307
+ definite: boolean;
2308
+ /**
2309
+ * The name(s) of the variable(s).
2310
+ */
2311
+ id: BindingName;
2312
+ /**
2313
+ * The initializer expression of the variable. Must be present for `const` unless
2314
+ * in a `declare const`.
2315
+ */
2316
+ init: Expression | null;
2317
+ }
2318
+ declare interface VariableDeclaratorDefiniteAssignment extends VariableDeclaratorBase {
2319
+ definite: true;
2320
+ /**
2321
+ * The name of the variable. Must have a type annotation.
2322
+ */
2323
+ id: Identifier;
2324
+ init: null;
2325
+ }
2326
+ declare interface VariableDeclaratorMaybeInit extends VariableDeclaratorBase {
2327
+ definite: false;
2328
+ }
2329
+ declare interface VariableDeclaratorNoInit extends VariableDeclaratorBase {
2330
+ definite: false;
2331
+ init: null;
2332
+ }
2333
+ declare interface WhileStatement extends BaseNode {
2334
+ type: AST_NODE_TYPES.WhileStatement;
2335
+ body: Statement;
2336
+ test: Expression;
2337
+ }
2338
+ declare interface WithStatement extends BaseNode {
2339
+ type: AST_NODE_TYPES.WithStatement;
2340
+ body: Statement;
2341
+ object: Expression;
2342
+ }
2343
+ declare interface YieldExpression extends BaseNode {
2344
+ type: AST_NODE_TYPES.YieldExpression;
2345
+ argument: Expression | null;
2346
+ delegate: boolean;
2347
+ }
2348
+
2349
+ declare const is: <NodeType extends AST_NODE_TYPES$2>(nodeType: NodeType) => (node: Node | null | undefined) => node is Extract<Node, {
202
2350
  type: NodeType;
203
2351
  }>;
204
- declare const isOneOf: <NodeTypes extends readonly TSESTree$1.AST_NODE_TYPES[]>(nodeTypes: NodeTypes) => (node: TSESTree$1.Node | null | undefined) => node is Extract<TSESTree$1.Node, {
2352
+ declare const isOneOf: <NodeTypes extends readonly AST_NODE_TYPES$2[]>(nodeTypes: NodeTypes) => (node: Node | null | undefined) => node is Extract<Node, {
205
2353
  type: NodeTypes[number];
206
2354
  }>;
207
- declare const isFunction: (node: TSESTree$1.Node | null | undefined) => node is TSESTree$1.ArrowFunctionExpression | TSESTree$1.FunctionDeclarationWithName | TSESTree$1.FunctionDeclarationWithOptionalName | TSESTree$1.FunctionExpression;
208
- declare const isFunctionType: (node: TSESTree$1.Node | null | undefined) => node is TSESTree$1.ArrowFunctionExpression | TSESTree$1.FunctionDeclarationWithName | TSESTree$1.FunctionDeclarationWithOptionalName | TSESTree$1.FunctionExpression | TSESTree$1.TSCallSignatureDeclaration | TSESTree$1.TSConstructSignatureDeclaration | TSESTree$1.TSDeclareFunctionNoDeclare | TSESTree$1.TSDeclareFunctionWithDeclare | TSESTree$1.TSEmptyBodyFunctionExpression | TSESTree$1.TSFunctionType | TSESTree$1.TSMethodSignatureComputedName | TSESTree$1.TSMethodSignatureNonComputedName;
209
- declare const isClass: (node: TSESTree$1.Node | null | undefined) => node is TSESTree$1.ClassDeclarationWithName | TSESTree$1.ClassDeclarationWithOptionalName | TSESTree$1.ClassExpression;
210
- declare const isMethodOrProperty: (node: TSESTree$1.Node | null | undefined) => node is TSESTree$1.MethodDefinitionComputedName | TSESTree$1.MethodDefinitionNonComputedName | TSESTree$1.PropertyDefinitionComputedName | TSESTree$1.PropertyDefinitionNonComputedName;
211
- declare const isLoop: (node: TSESTree$1.Node | null | undefined) => node is TSESTree$1.DoWhileStatement | TSESTree$1.ForInStatement | TSESTree$1.ForOfStatement | TSESTree$1.ForStatement | TSESTree$1.WhileStatement;
212
- declare const isControlFlow: (data: TSESTree$1.Node | null | undefined) => data is TSESTree$1.DoWhileStatement | TSESTree$1.ForInStatement | TSESTree$1.ForOfStatement | TSESTree$1.ForStatement | TSESTree$1.IfStatement | TSESTree$1.SwitchStatement | TSESTree$1.WhileStatement;
213
- declare const isConditional: (data: TSESTree$1.Node | null | undefined) => data is TSESTree$1.ConditionalExpression | TSESTree$1.DoWhileStatement | TSESTree$1.ForInStatement | TSESTree$1.ForOfStatement | TSESTree$1.ForStatement | TSESTree$1.IfStatement | TSESTree$1.LogicalExpression | TSESTree$1.SwitchStatement | TSESTree$1.WhileStatement;
214
- declare const isArrayTupleType: (node: TSESTree$1.Node | null | undefined) => node is TSESTree$1.TSArrayType | TSESTree$1.TSTupleType;
215
- declare const isProperty: (node: TSESTree$1.Node | null | undefined) => node is TSESTree$1.PropertyDefinitionComputedName | TSESTree$1.PropertyDefinitionNonComputedName | TSESTree$1.TSIndexSignature | TSESTree$1.TSParameterProperty | TSESTree$1.TSPropertySignatureComputedName | TSESTree$1.TSPropertySignatureNonComputedName;
216
- declare const isJSXElement: (node: TSESTree$1.Node | null | undefined) => node is TSESTree$1.JSXElement;
217
- declare const isJSXFragment: (node: TSESTree$1.Node | null | undefined) => node is TSESTree$1.JSXFragment;
218
- declare const isJSXTagNameExpression: (node: TSESTree$1.Node | null | undefined) => node is TSESTree$1.JSXIdentifier | TSESTree$1.JSXMemberExpression | TSESTree$1.JSXNamespacedName;
219
- declare const isJSX: (node: TSESTree$1.Node | null | undefined) => node is TSESTree$1.JSXAttribute | TSESTree$1.JSXClosingElement | TSESTree$1.JSXClosingFragment | TSESTree$1.JSXElement | TSESTree$1.JSXEmptyExpression | TSESTree$1.JSXExpressionContainer | TSESTree$1.JSXFragment | TSESTree$1.JSXIdentifier | TSESTree$1.JSXMemberExpression | TSESTree$1.JSXNamespacedName | TSESTree$1.JSXOpeningElement | TSESTree$1.JSXOpeningFragment | TSESTree$1.JSXSpreadAttribute | TSESTree$1.JSXSpreadChild | TSESTree$1.JSXText;
220
- declare const isDestructuringPattern: (node: TSESTree$1.Node | null | undefined) => node is TSESTree$1.ArrayPattern | TSESTree$1.AssignmentPattern | TSESTree$1.ObjectPattern | TSESTree$1.RestElement;
221
- declare const isTypeDeclaration: (node: TSESTree$1.Node | null | undefined) => node is TSESTree$1.TSInterfaceDeclaration | TSESTree$1.TSTypeAliasDeclaration;
222
- declare const isLeftHandSideExpression: (node: TSESTree$1.Node | null | undefined) => node is TSESTree$1.ArrayExpression | TSESTree$1.ArrayPattern | TSESTree$1.ArrowFunctionExpression | TSESTree$1.CallExpression | TSESTree$1.ClassExpression | TSESTree$1.FunctionExpression | TSESTree$1.Identifier | TSESTree$1.JSXElement | TSESTree$1.JSXFragment | TSESTree$1.BigIntLiteral | TSESTree$1.BooleanLiteral | TSESTree$1.NullLiteral | TSESTree$1.NumberLiteral | TSESTree$1.RegExpLiteral | TSESTree$1.StringLiteral | TSESTree$1.MemberExpressionComputedName | TSESTree$1.MemberExpressionNonComputedName | TSESTree$1.MetaProperty | TSESTree$1.ObjectExpression | TSESTree$1.ObjectPattern | TSESTree$1.SequenceExpression | TSESTree$1.Super | TSESTree$1.TaggedTemplateExpression | TSESTree$1.TemplateLiteral | TSESTree$1.ThisExpression;
223
- declare const isLeftHandSideExpressionType: (node: TSESTree$1.Node | null | undefined) => node is TSESTree$1.ArrayExpression | TSESTree$1.ArrayPattern | TSESTree$1.ArrowFunctionExpression | TSESTree$1.CallExpression | TSESTree$1.ClassExpression | TSESTree$1.FunctionExpression | TSESTree$1.Identifier | TSESTree$1.JSXElement | TSESTree$1.JSXFragment | TSESTree$1.BigIntLiteral | TSESTree$1.BooleanLiteral | TSESTree$1.NullLiteral | TSESTree$1.NumberLiteral | TSESTree$1.RegExpLiteral | TSESTree$1.StringLiteral | TSESTree$1.MemberExpressionComputedName | TSESTree$1.MemberExpressionNonComputedName | TSESTree$1.MetaProperty | TSESTree$1.ObjectExpression | TSESTree$1.ObjectPattern | TSESTree$1.SequenceExpression | TSESTree$1.Super | TSESTree$1.TaggedTemplateExpression | TSESTree$1.TemplateLiteral | TSESTree$1.ThisExpression | TSESTree$1.TSAsExpression | TSESTree$1.TSNonNullExpression | TSESTree$1.TSTypeAssertion;
224
- declare const isTypeExpression: (node: TSESTree$1.Node | null | undefined) => node is TSESTree$1.TSAsExpression | TSESTree$1.TSInstantiationExpression | TSESTree$1.TSNonNullExpression | TSESTree$1.TSSatisfiesExpression | TSESTree$1.TSTypeAssertion;
225
- declare const isTypeAssertionExpression: (node: TSESTree$1.Node | null | undefined) => node is TSESTree$1.TSAsExpression | TSESTree$1.TSNonNullExpression | TSESTree$1.TSSatisfiesExpression | TSESTree$1.TSTypeAssertion;
2355
+ declare const isFunction: (node: Node | null | undefined) => node is ArrowFunctionExpression | FunctionDeclarationWithName | FunctionDeclarationWithOptionalName | FunctionExpression;
2356
+ declare const isFunctionType: (node: Node | null | undefined) => node is ArrowFunctionExpression | FunctionDeclarationWithName | FunctionDeclarationWithOptionalName | FunctionExpression | TSCallSignatureDeclaration | TSConstructSignatureDeclaration | TSDeclareFunctionNoDeclare | TSDeclareFunctionWithDeclare | TSEmptyBodyFunctionExpression | TSFunctionType | TSMethodSignatureComputedName | TSMethodSignatureNonComputedName;
2357
+ declare const isClass: (node: Node | null | undefined) => node is ClassDeclarationWithName | ClassDeclarationWithOptionalName | ClassExpression;
2358
+ declare const isMethodOrProperty: (node: Node | null | undefined) => node is MethodDefinitionComputedName | MethodDefinitionNonComputedName | PropertyDefinitionComputedName | PropertyDefinitionNonComputedName;
2359
+ declare const isLoop: (node: Node | null | undefined) => node is DoWhileStatement | ForInStatement | ForOfStatement | ForStatement | WhileStatement;
2360
+ declare const isControlFlow: (data: Node | null | undefined) => data is DoWhileStatement | ForInStatement | ForOfStatement | ForStatement | IfStatement | SwitchStatement | WhileStatement;
2361
+ declare const isConditional: (data: Node | null | undefined) => data is ConditionalExpression | DoWhileStatement | ForInStatement | ForOfStatement | ForStatement | IfStatement | LogicalExpression | SwitchStatement | WhileStatement;
2362
+ declare const isArrayTupleType: (node: Node | null | undefined) => node is TSArrayType | TSTupleType;
2363
+ declare const isProperty: (node: Node | null | undefined) => node is PropertyDefinitionComputedName | PropertyDefinitionNonComputedName | TSIndexSignature | TSParameterProperty | TSPropertySignatureComputedName | TSPropertySignatureNonComputedName;
2364
+ declare const isJSXElement: (node: Node | null | undefined) => node is JSXElement;
2365
+ declare const isJSXFragment: (node: Node | null | undefined) => node is JSXFragment;
2366
+ declare const isJSXTagNameExpression: (node: Node | null | undefined) => node is JSXIdentifier | JSXMemberExpression | JSXNamespacedName;
2367
+ declare const isJSX: (node: Node | null | undefined) => node is JSXAttribute | JSXClosingElement | JSXClosingFragment | JSXElement | JSXEmptyExpression | JSXExpressionContainer | JSXFragment | JSXIdentifier | JSXMemberExpression | JSXNamespacedName | JSXOpeningElement | JSXOpeningFragment | JSXSpreadAttribute | JSXSpreadChild | JSXText;
2368
+ declare const isDestructuringPattern: (node: Node | null | undefined) => node is ArrayPattern | AssignmentPattern | ObjectPattern | RestElement;
2369
+ declare const isTypeDeclaration: (node: Node | null | undefined) => node is TSInterfaceDeclaration | TSTypeAliasDeclaration;
2370
+ declare const isLeftHandSideExpression: (node: Node | null | undefined) => node is ArrayExpression | ArrayPattern | ArrowFunctionExpression | CallExpression | ClassExpression | FunctionExpression | Identifier | JSXElement | JSXFragment | BigIntLiteral | BooleanLiteral | NullLiteral | NumberLiteral | RegExpLiteral | StringLiteral | MemberExpressionComputedName | MemberExpressionNonComputedName | MetaProperty | ObjectExpression | ObjectPattern | SequenceExpression | Super | TaggedTemplateExpression | TemplateLiteral | ThisExpression;
2371
+ declare const isLeftHandSideExpressionType: (node: Node | null | undefined) => node is ArrayExpression | ArrayPattern | ArrowFunctionExpression | CallExpression | ClassExpression | FunctionExpression | Identifier | JSXElement | JSXFragment | BigIntLiteral | BooleanLiteral | NullLiteral | NumberLiteral | RegExpLiteral | StringLiteral | MemberExpressionComputedName | MemberExpressionNonComputedName | MetaProperty | ObjectExpression | ObjectPattern | SequenceExpression | Super | TaggedTemplateExpression | TemplateLiteral | ThisExpression | TSAsExpression | TSNonNullExpression | TSTypeAssertion;
2372
+ declare const isTypeExpression: (node: Node | null | undefined) => node is TSAsExpression | TSInstantiationExpression | TSNonNullExpression | TSSatisfiesExpression | TSTypeAssertion;
2373
+ declare const isTypeAssertionExpression: (node: Node | null | undefined) => node is TSAsExpression | TSNonNullExpression | TSSatisfiesExpression | TSTypeAssertion;
226
2374
 
227
2375
  declare function isArrayFromCall(node: TSESTree.Node, loose?: boolean): node is TSESTree.CallExpression;
228
2376