@eslint-react/ast 1.28.1-next.4 → 1.28.1-next.5

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