@eslint-react/kit 5.5.1-next.0 → 5.5.2-beta.0

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