@eslint-react/core 1.17.2-next.5 → 1.17.2-next.7

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