flow-api-translator 0.10.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.
@@ -0,0 +1,2052 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * @flow strict-local
8
+ * @format
9
+ */
10
+
11
+ /**
12
+ * The following types have been adapted by hand from
13
+ * https://unpkg.com/browse/@typescript-eslint/types@5.41.0/dist/generated/ast-spec.d.ts
14
+ *
15
+ * Changes:
16
+ * - remove and inline `ValueOf` type
17
+ * - `undefined` -> `void`
18
+ * - remove all `declare` keywords
19
+ * - comment out `bigint` type
20
+ * -> flow doesn't support it yet
21
+ * - remove `range` and `loc` from `NodeOrTokenData`
22
+ * -> during conversion our locations will be all off, so we'll rely on prettier to print later
23
+ * - make all properties readonly and all arrays $ReadOnlyArray
24
+ * -> unlike TS - flow enforces subtype constraints strictly!
25
+ * - add `type` to interfaces that previously relied upon inheriting the `type`
26
+ * -> this is because flow sentinel refinement does not check inherited members
27
+ * - create "Ambiguous" versions for some nodes that have unions (like PropertyDefinition, MemberDefinition)
28
+ * -> makes it easier to construct them from other nodes that have unions
29
+ */
30
+
31
+ 'use strict';
32
+
33
+ interface NodeOrTokenData {}
34
+ interface BaseNode extends NodeOrTokenData {}
35
+ interface BaseToken extends NodeOrTokenData {
36
+ +value: string;
37
+ }
38
+
39
+ export type Accessibility = 'private' | 'protected' | 'public';
40
+ export interface ArrayExpression extends BaseNode {
41
+ +type: 'ArrayExpression';
42
+ +elements: $ReadOnlyArray<Expression | SpreadElement>;
43
+ }
44
+ export interface ArrayPattern extends BaseNode {
45
+ +type: 'ArrayPattern';
46
+ +elements: $ReadOnlyArray<DestructuringPattern | null>;
47
+ +typeAnnotation?: TSTypeAnnotation;
48
+ +optional?: boolean;
49
+ +decorators?: $ReadOnlyArray<Decorator>;
50
+ }
51
+ export interface ArrowFunctionExpression extends BaseNode {
52
+ +type: 'ArrowFunctionExpression';
53
+ +generator: boolean;
54
+ +id: null;
55
+ +params: $ReadOnlyArray<Parameter>;
56
+ +body: BlockStatement | Expression;
57
+ +async: boolean;
58
+ +expression: boolean;
59
+ +returnType?: TSTypeAnnotation;
60
+ +typeParameters?: TSTypeParameterDeclaration;
61
+ }
62
+ export interface AssignmentExpression extends BaseNode {
63
+ +type: 'AssignmentExpression';
64
+ +operator:
65
+ | '='
66
+ | '+='
67
+ | '-='
68
+ | '*='
69
+ | '**='
70
+ | '/='
71
+ | '%='
72
+ | '<<='
73
+ | '>>='
74
+ | '>>>='
75
+ | '&='
76
+ | '|='
77
+ | '||='
78
+ | '&&='
79
+ | '??='
80
+ | '^=';
81
+ +left: Expression;
82
+ +right: Expression;
83
+ }
84
+ export interface AssignmentPattern extends BaseNode {
85
+ +type: 'AssignmentPattern';
86
+ +left: BindingName;
87
+ +right: Expression;
88
+ +typeAnnotation?: TSTypeAnnotation;
89
+ +optional?: boolean;
90
+ +decorators?: $ReadOnlyArray<Decorator>;
91
+ }
92
+ export interface AwaitExpression extends BaseNode {
93
+ +type: 'AwaitExpression';
94
+ +argument: Expression;
95
+ }
96
+ export interface BigIntLiteral extends LiteralBase {
97
+ +type: 'Literal';
98
+ +value: /*bigint |*/ null;
99
+ +bigint: string;
100
+ }
101
+ export interface BinaryExpression extends BaseNode {
102
+ +type: 'BinaryExpression';
103
+ +operator: string;
104
+ +left: Expression | PrivateIdentifier;
105
+ +right: Expression;
106
+ }
107
+ export type BindingName = BindingPattern | Identifier;
108
+ export type BindingPattern = ArrayPattern | ObjectPattern;
109
+ export interface BlockComment extends BaseToken {
110
+ +type: 'Block';
111
+ }
112
+ export interface BlockStatement extends BaseNode {
113
+ +type: 'BlockStatement';
114
+ +body: $ReadOnlyArray<Statement>;
115
+ }
116
+ export interface BooleanLiteral extends LiteralBase {
117
+ +type: 'Literal';
118
+ +value: boolean;
119
+ +raw: 'false' | 'true';
120
+ }
121
+ export interface BooleanToken extends BaseToken {
122
+ +type: 'Boolean';
123
+ }
124
+ export interface BreakStatement extends BaseNode {
125
+ +type: 'BreakStatement';
126
+ +label: Identifier | null;
127
+ }
128
+ export interface CallExpression extends BaseNode {
129
+ +type: 'CallExpression';
130
+ +callee: LeftHandSideExpression;
131
+ +arguments: $ReadOnlyArray<CallExpressionArgument>;
132
+ +typeParameters?: TSTypeParameterInstantiation;
133
+ +optional: boolean;
134
+ }
135
+ export type CallExpressionArgument = Expression | SpreadElement;
136
+ export interface CatchClause extends BaseNode {
137
+ +type: 'CatchClause';
138
+ +param: BindingName | null;
139
+ +body: BlockStatement;
140
+ }
141
+ export type ChainElement =
142
+ | CallExpression
143
+ | MemberExpression
144
+ | TSNonNullExpression;
145
+ export interface ChainExpression extends BaseNode {
146
+ +type: 'ChainExpression';
147
+ +expression: ChainElement;
148
+ }
149
+ interface ClassBase extends BaseNode {
150
+ /**
151
+ * Whether the class is an abstract class.
152
+ * ```
153
+ * abstract class Foo {...}
154
+ * ```
155
+ * This is always `undefined` for `ClassExpression`.
156
+ */
157
+ +abstract?: boolean;
158
+ /**
159
+ * The class body.
160
+ */
161
+ +body: ClassBody;
162
+ /**
163
+ * Whether the class has been `declare`d:
164
+ * ```
165
+ * declare class Foo {...}
166
+ * ```
167
+ * This is always `undefined` for `ClassExpression`.
168
+ */
169
+ +declare?: boolean;
170
+ /**
171
+ * The decorators declared for the class.
172
+ * This is `undefined` if there are no decorators.
173
+ * ```
174
+ * @deco
175
+ * class Foo {...}
176
+ * ```
177
+ * This is always `undefined` for `ClassExpression`.
178
+ */
179
+ +decorators?: $ReadOnlyArray<Decorator>;
180
+ /**
181
+ * The class's name.
182
+ * - For a `ClassExpression` this may be `null` if the name is omitted.
183
+ * - For a `ClassDeclaration` this may be `null` if and only if the parent is
184
+ * an `ExportDefaultDeclaration`.
185
+ */
186
+ +id: Identifier | null;
187
+ /**
188
+ * The implemented interfaces for the class.
189
+ * This is `undefined` if there are no implemented interfaces.
190
+ */
191
+ +implements?: $ReadOnlyArray<TSClassImplements>;
192
+ /**
193
+ * The super class this class extends.
194
+ */
195
+ +superClass: LeftHandSideExpression | null;
196
+ /**
197
+ * The generic type parameters passed to the superClass.
198
+ * This is `undefined` if there are no generic type parameters passed.
199
+ */
200
+ +superTypeParameters?: TSTypeParameterInstantiation;
201
+ /**
202
+ * The generic type parameters declared for the class.
203
+ * This is `undefined` if there are no generic type parameters declared.
204
+ */
205
+ +typeParameters?: TSTypeParameterDeclaration;
206
+ }
207
+ export interface ClassBody extends BaseNode {
208
+ +type: 'ClassBody';
209
+ +body: $ReadOnlyArray<ClassElement>;
210
+ }
211
+ export type ClassDeclaration =
212
+ | ClassDeclarationWithName
213
+ | ClassDeclarationWithOptionalName;
214
+ interface ClassDeclarationBase extends ClassBase {
215
+ +type: 'ClassDeclaration';
216
+ }
217
+ export interface ClassDeclarationWithName extends ClassDeclarationBase {
218
+ +type: 'ClassDeclaration';
219
+ +id: Identifier;
220
+ }
221
+ export interface ClassDeclarationWithOptionalName extends ClassDeclarationBase {
222
+ +type: 'ClassDeclaration';
223
+ +id: Identifier | null;
224
+ }
225
+ export type ClassElement =
226
+ | MethodDefinition
227
+ | PropertyDefinition
228
+ | MethodDefinitionAmbiguous
229
+ | PropertyDefinitionAmbiguous
230
+ | StaticBlock
231
+ | TSAbstractMethodDefinition
232
+ | TSAbstractPropertyDefinition
233
+ | TSIndexSignature;
234
+ export interface ClassExpression extends ClassBase {
235
+ +type: 'ClassExpression';
236
+ +abstract?: void;
237
+ +declare?: void;
238
+ +decorators?: void;
239
+ }
240
+ interface ClassMethodDefinitionNonComputedNameBase
241
+ extends MethodDefinitionBase {
242
+ +type: 'MethodDefinition';
243
+ +key: ClassPropertyNameNonComputed;
244
+ +computed: false;
245
+ }
246
+ interface ClassPropertyDefinitionNonComputedNameBase
247
+ extends PropertyDefinitionBase {
248
+ +type: 'PropertyDefinition';
249
+ +key: ClassPropertyNameNonComputed;
250
+ +computed: false;
251
+ }
252
+ export type ClassPropertyNameNonComputed =
253
+ | PrivateIdentifier
254
+ | PropertyNameNonComputed;
255
+ export type Comment = BlockComment | LineComment;
256
+ export interface ConditionalExpression extends BaseNode {
257
+ +type: 'ConditionalExpression';
258
+ +test: Expression;
259
+ +consequent: Expression;
260
+ +alternate: Expression;
261
+ }
262
+ export interface ContinueStatement extends BaseNode {
263
+ +type: 'ContinueStatement';
264
+ +label: Identifier | null;
265
+ }
266
+ export interface DebuggerStatement extends BaseNode {
267
+ +type: 'DebuggerStatement';
268
+ }
269
+ export type DeclarationStatement =
270
+ | ClassDeclaration
271
+ | ClassExpression
272
+ | ExportAllDeclaration
273
+ | ExportDefaultDeclaration
274
+ | ExportNamedDeclaration
275
+ | FunctionDeclaration
276
+ | TSDeclareFunction
277
+ | TSEnumDeclaration
278
+ | TSImportEqualsDeclaration
279
+ | TSInterfaceDeclaration
280
+ | TSModuleDeclaration
281
+ | TSNamespaceExportDeclaration
282
+ | TSTypeAliasDeclaration;
283
+ export interface Decorator extends BaseNode {
284
+ +type: 'Decorator';
285
+ +expression: LeftHandSideExpression;
286
+ }
287
+ export type DefaultExportDeclarations =
288
+ | ClassDeclarationWithOptionalName
289
+ | Expression
290
+ | FunctionDeclarationWithName
291
+ | FunctionDeclarationWithOptionalName
292
+ | TSDeclareFunction
293
+ | TSEnumDeclaration
294
+ | TSInterfaceDeclaration
295
+ | TSModuleDeclaration
296
+ | TSTypeAliasDeclaration
297
+ | VariableDeclaration;
298
+ export type DestructuringPattern =
299
+ | ArrayPattern
300
+ | AssignmentPattern
301
+ | Identifier
302
+ | MemberExpression
303
+ | ObjectPattern
304
+ | RestElement;
305
+ export interface DoWhileStatement extends BaseNode {
306
+ +type: 'DoWhileStatement';
307
+ +test: Expression;
308
+ +body: Statement;
309
+ }
310
+ export interface EmptyStatement extends BaseNode {
311
+ +type: 'EmptyStatement';
312
+ }
313
+ export type EntityName = Identifier | ThisExpression | TSQualifiedName;
314
+ export interface ExportAllDeclaration extends BaseNode {
315
+ +type: 'ExportAllDeclaration';
316
+ /**
317
+ * The assertions declared for the export.
318
+ * ```
319
+ * export * from 'mod' assert { type: 'json' };
320
+ * ```
321
+ */
322
+ +assertions: $ReadOnlyArray<ImportAttribute>;
323
+ /**
324
+ * The name for the exported items. `null` if no name is assigned.
325
+ */
326
+ +exported: Identifier | null;
327
+ /**
328
+ * The kind of the export.
329
+ */
330
+ +exportKind: ExportKind;
331
+ /**
332
+ * The source module being exported from.
333
+ */
334
+ +source: StringLiteral;
335
+ }
336
+ type ExportAndImportKind = 'type' | 'value';
337
+ export type ExportDeclaration =
338
+ | DefaultExportDeclarations
339
+ | NamedExportDeclarations;
340
+ export interface ExportDefaultDeclaration extends BaseNode {
341
+ +type: 'ExportDefaultDeclaration';
342
+ /**
343
+ * The declaration being exported.
344
+ */
345
+ +declaration: DefaultExportDeclarations;
346
+ /**
347
+ * The kind of the export.
348
+ */
349
+ +exportKind: ExportKind;
350
+ }
351
+ type ExportKind = ExportAndImportKind;
352
+ export type ExportNamedDeclaration =
353
+ | ExportNamedDeclarationWithoutSourceWithMultiple
354
+ | ExportNamedDeclarationWithoutSourceWithSingle
355
+ | ExportNamedDeclarationWithSource;
356
+ interface ExportNamedDeclarationBase extends BaseNode {
357
+ +type: 'ExportNamedDeclaration';
358
+ /**
359
+ * The assertions declared for the export.
360
+ * ```
361
+ * export { foo } from 'mod' assert { type: 'json' };
362
+ * ```
363
+ * This will be an empty array if `source` is `null`
364
+ */
365
+ +assertions: $ReadOnlyArray<ImportAttribute>;
366
+ /**
367
+ * The exported declaration.
368
+ * ```
369
+ * export const x = 1;
370
+ * ```
371
+ * This will be `null` if `source` is not `null`, or if there are `specifiers`
372
+ */
373
+ +declaration: NamedExportDeclarations | null;
374
+ /**
375
+ * The kind of the export.
376
+ */
377
+ +exportKind: ExportKind;
378
+ /**
379
+ * The source module being exported from.
380
+ */
381
+ +source: StringLiteral | null;
382
+ /**
383
+ * The specifiers being exported.
384
+ * ```
385
+ * export { a, b };
386
+ * ```
387
+ * This will be an empty array if `declaration` is not `null`
388
+ */
389
+ +specifiers: $ReadOnlyArray<ExportSpecifier>;
390
+ }
391
+ export interface ExportNamedDeclarationAmbiguous
392
+ extends ExportNamedDeclarationBase {
393
+ +type: 'ExportNamedDeclaration';
394
+ }
395
+ export interface ExportNamedDeclarationWithoutSourceWithSingle
396
+ extends ExportNamedDeclarationBase {
397
+ +type: 'ExportNamedDeclaration';
398
+ +assertions: $ReadOnlyArray<ImportAttribute>;
399
+ +declaration: NamedExportDeclarations;
400
+ +source: null;
401
+ +specifiers: [];
402
+ }
403
+ export interface ExportNamedDeclarationWithoutSourceWithMultiple
404
+ extends ExportNamedDeclarationBase {
405
+ +type: 'ExportNamedDeclaration';
406
+ +assertions: $ReadOnlyArray<ImportAttribute>;
407
+ +declaration: null;
408
+ +source: null;
409
+ +specifiers: $ReadOnlyArray<ExportSpecifier>;
410
+ }
411
+ export interface ExportNamedDeclarationWithSource
412
+ extends ExportNamedDeclarationBase {
413
+ +type: 'ExportNamedDeclaration';
414
+ +assertions: $ReadOnlyArray<ImportAttribute>;
415
+ +declaration: null;
416
+ +source: StringLiteral;
417
+ +specifiers: $ReadOnlyArray<ExportSpecifier>;
418
+ }
419
+ export interface ExportSpecifier extends BaseNode {
420
+ +type: 'ExportSpecifier';
421
+ +local: Identifier;
422
+ +exported: Identifier;
423
+ +exportKind: ExportKind;
424
+ }
425
+ export type Expression =
426
+ | ArrayExpression
427
+ | ArrayPattern
428
+ | ArrowFunctionExpression
429
+ | AssignmentExpression
430
+ | AwaitExpression
431
+ | BinaryExpression
432
+ | CallExpression
433
+ | ChainExpression
434
+ | ClassExpression
435
+ | ConditionalExpression
436
+ | FunctionExpression
437
+ | Identifier
438
+ | ImportExpression
439
+ | JSXElement
440
+ | JSXFragment
441
+ | LiteralExpression
442
+ | LogicalExpression
443
+ | MemberExpression
444
+ | MetaProperty
445
+ | NewExpression
446
+ | ObjectExpression
447
+ | ObjectPattern
448
+ | SequenceExpression
449
+ | Super
450
+ | TaggedTemplateExpression
451
+ | TemplateLiteral
452
+ | ThisExpression
453
+ | TSAsExpression
454
+ | TSInstantiationExpression
455
+ | TSNonNullExpression
456
+ | TSTypeAssertion
457
+ | UnaryExpression
458
+ | UpdateExpression
459
+ | YieldExpression;
460
+ export interface ExpressionStatement extends BaseNode {
461
+ +type: 'ExpressionStatement';
462
+ +expression: Expression;
463
+ +directive?: string;
464
+ }
465
+ export type ForInitialiser = Expression | VariableDeclaration;
466
+ export interface ForInStatement extends BaseNode {
467
+ +type: 'ForInStatement';
468
+ +left: ForInitialiser;
469
+ +right: Expression;
470
+ +body: Statement;
471
+ }
472
+ export interface ForOfStatement extends BaseNode {
473
+ +type: 'ForOfStatement';
474
+ +left: ForInitialiser;
475
+ +right: Expression;
476
+ +body: Statement;
477
+ +await: boolean;
478
+ }
479
+ export interface ForStatement extends BaseNode {
480
+ +type: 'ForStatement';
481
+ +init: Expression | ForInitialiser | null;
482
+ +test: Expression | null;
483
+ +update: Expression | null;
484
+ +body: Statement;
485
+ }
486
+ interface FunctionBase extends BaseNode {
487
+ /**
488
+ * Whether the function is async:
489
+ * ```
490
+ * async function foo(...) {...}
491
+ * const x = async function (...) {...}
492
+ * const x = async (...) => {...}
493
+ * ```
494
+ */
495
+ +async: boolean;
496
+ /**
497
+ * The body of the function.
498
+ * - For an `ArrowFunctionExpression` this may be an `Expression` or `BlockStatement`.
499
+ * - For a `FunctionDeclaration` or `FunctionExpression` this is always a `BlockStatement.
500
+ * - For a `TSDeclareFunction` this is always `undefined`.
501
+ * - For a `TSEmptyBodyFunctionExpression` this is always `null`.
502
+ */
503
+ +body?: BlockStatement | Expression | null;
504
+ /**
505
+ * This is only `true` if and only if the node is a `TSDeclareFunction` and it has `declare`:
506
+ * ```
507
+ * declare function foo(...) {...}
508
+ * ```
509
+ */
510
+ +declare?: boolean;
511
+ /**
512
+ * This is only ever `true` if and only the node is an `ArrowFunctionExpression` and the body
513
+ * is an expression:
514
+ * ```
515
+ * (() => 1)
516
+ * ```
517
+ */
518
+ +expression: boolean;
519
+ /**
520
+ * Whether the function is a generator function:
521
+ * ```
522
+ * function *foo(...) {...}
523
+ * const x = function *(...) {...}
524
+ * ```
525
+ * This is always `false` for arrow functions as they cannot be generators.
526
+ */
527
+ +generator: boolean;
528
+ /**
529
+ * The function's name.
530
+ * - For an `ArrowFunctionExpression` this is always `null`.
531
+ * - For a `FunctionExpression` this may be `null` if the name is omitted.
532
+ * - For a `FunctionDeclaration` or `TSDeclareFunction` this may be `null` if
533
+ * and only if the parent is an `ExportDefaultDeclaration`.
534
+ */
535
+ +id: Identifier | null;
536
+ /**
537
+ * The list of parameters declared for the function.
538
+ */
539
+ +params: $ReadOnlyArray<Parameter>;
540
+ /**
541
+ * The return type annotation for the function.
542
+ * This is `undefined` if there is no return type declared.
543
+ */
544
+ +returnType?: TSTypeAnnotation;
545
+ /**
546
+ * The generic type parameter declaration for the function.
547
+ * This is `undefined` if there are no generic type parameters declared.
548
+ */
549
+ +typeParameters?: TSTypeParameterDeclaration;
550
+ }
551
+ export type FunctionDeclaration =
552
+ | FunctionDeclarationWithName
553
+ | FunctionDeclarationWithOptionalName;
554
+ interface FunctionDeclarationBase extends FunctionBase {
555
+ +type: 'FunctionDeclaration';
556
+ +body: BlockStatement;
557
+ +declare?: false;
558
+ +expression: false;
559
+ }
560
+ export interface FunctionDeclarationWithName extends FunctionDeclarationBase {
561
+ +type: 'FunctionDeclaration';
562
+ +id: Identifier;
563
+ }
564
+ export interface FunctionDeclarationWithOptionalName
565
+ extends FunctionDeclarationBase {
566
+ +type: 'FunctionDeclaration';
567
+ +id: Identifier | null;
568
+ }
569
+ export interface FunctionExpression extends FunctionBase {
570
+ +type: 'FunctionExpression';
571
+ +body: BlockStatement;
572
+ +expression: false;
573
+ }
574
+ export type FunctionLike =
575
+ | ArrowFunctionExpression
576
+ | FunctionDeclaration
577
+ | FunctionExpression
578
+ | TSDeclareFunction
579
+ | TSEmptyBodyFunctionExpression;
580
+ export interface Identifier extends BaseNode {
581
+ +type: 'Identifier';
582
+ +name: string;
583
+ +typeAnnotation?: TSTypeAnnotation;
584
+ +optional?: boolean;
585
+ +decorators?: $ReadOnlyArray<Decorator>;
586
+ }
587
+ export interface IdentifierToken extends BaseToken {
588
+ +type: 'Identifier';
589
+ }
590
+ export interface IfStatement extends BaseNode {
591
+ +type: 'IfStatement';
592
+ +test: Expression;
593
+ +consequent: Statement;
594
+ +alternate: Statement | null;
595
+ }
596
+ export interface ImportAttribute extends BaseNode {
597
+ +type: 'ImportAttribute';
598
+ +key: Identifier | Literal;
599
+ +value: Literal;
600
+ }
601
+ export type ImportClause =
602
+ | ImportDefaultSpecifier
603
+ | ImportNamespaceSpecifier
604
+ | ImportSpecifier;
605
+ export interface ImportDeclaration extends BaseNode {
606
+ +type: 'ImportDeclaration';
607
+ /**
608
+ * The assertions declared for the export.
609
+ * ```
610
+ * import * from 'mod' assert { type: 'json' };
611
+ * ```
612
+ */
613
+ +assertions: $ReadOnlyArray<ImportAttribute>;
614
+ /**
615
+ * The kind of the import.
616
+ */
617
+ +importKind: ImportKind;
618
+ /**
619
+ * The source module being imported from.
620
+ */
621
+ +source: StringLiteral;
622
+ /**
623
+ * The specifiers being imported.
624
+ * If this is an empty array then either there are no specifiers:
625
+ * ```
626
+ * import {} from 'mod';
627
+ * ```
628
+ * Or it is a side-effect import:
629
+ * ```
630
+ * import 'mod';
631
+ * ```
632
+ */
633
+ +specifiers: $ReadOnlyArray<ImportClause>;
634
+ }
635
+ export interface ImportDefaultSpecifier extends BaseNode {
636
+ +type: 'ImportDefaultSpecifier';
637
+ +local: Identifier;
638
+ }
639
+ export interface ImportExpression extends BaseNode {
640
+ +type: 'ImportExpression';
641
+ +source: Expression;
642
+ +attributes: Expression | null;
643
+ }
644
+ type ImportKind = ExportAndImportKind;
645
+ export interface ImportNamespaceSpecifier extends BaseNode {
646
+ +type: 'ImportNamespaceSpecifier';
647
+ +local: Identifier;
648
+ }
649
+ export interface ImportSpecifier extends BaseNode {
650
+ +type: 'ImportSpecifier';
651
+ +local: Identifier;
652
+ +imported: Identifier;
653
+ +importKind: ImportKind;
654
+ }
655
+ export type IterationStatement =
656
+ | DoWhileStatement
657
+ | ForInStatement
658
+ | ForOfStatement
659
+ | ForStatement
660
+ | WhileStatement;
661
+ export interface JSXAttribute extends BaseNode {
662
+ +type: 'JSXAttribute';
663
+ +name: JSXIdentifier | JSXNamespacedName;
664
+ +value: JSXExpression | Literal | null;
665
+ }
666
+ export type JSXChild = JSXElement | JSXExpression | JSXFragment | JSXText;
667
+ export interface JSXClosingElement extends BaseNode {
668
+ +type: 'JSXClosingElement';
669
+ +name: JSXTagNameExpression;
670
+ }
671
+ export interface JSXClosingFragment extends BaseNode {
672
+ +type: 'JSXClosingFragment';
673
+ }
674
+ export interface JSXElement extends BaseNode {
675
+ +type: 'JSXElement';
676
+ +openingElement: JSXOpeningElement;
677
+ +closingElement: JSXClosingElement | null;
678
+ +children: $ReadOnlyArray<JSXChild>;
679
+ }
680
+ export interface JSXEmptyExpression extends BaseNode {
681
+ +type: 'JSXEmptyExpression';
682
+ }
683
+ export type JSXExpression =
684
+ | JSXEmptyExpression
685
+ | JSXExpressionContainer
686
+ | JSXSpreadChild;
687
+ export interface JSXExpressionContainer extends BaseNode {
688
+ +type: 'JSXExpressionContainer';
689
+ +expression: Expression | JSXEmptyExpression;
690
+ }
691
+ export interface JSXFragment extends BaseNode {
692
+ +type: 'JSXFragment';
693
+ +openingFragment: JSXOpeningFragment;
694
+ +closingFragment: JSXClosingFragment;
695
+ +children: $ReadOnlyArray<JSXChild>;
696
+ }
697
+ export interface JSXIdentifier extends BaseNode {
698
+ +type: 'JSXIdentifier';
699
+ +name: string;
700
+ }
701
+ export interface JSXIdentifierToken extends BaseToken {
702
+ +type: 'JSXIdentifier';
703
+ }
704
+ export interface JSXMemberExpression extends BaseNode {
705
+ +type: 'JSXMemberExpression';
706
+ +object: JSXTagNameExpression;
707
+ +property: JSXIdentifier;
708
+ }
709
+ export interface JSXNamespacedName extends BaseNode {
710
+ +type: 'JSXNamespacedName';
711
+ +namespace: JSXIdentifier;
712
+ +name: JSXIdentifier;
713
+ }
714
+ export interface JSXOpeningElement extends BaseNode {
715
+ +type: 'JSXOpeningElement';
716
+ +typeParameters?: TSTypeParameterInstantiation;
717
+ +selfClosing: boolean;
718
+ +name: JSXTagNameExpression;
719
+ +attributes: $ReadOnlyArray<JSXAttribute | JSXSpreadAttribute>;
720
+ }
721
+ export interface JSXOpeningFragment extends BaseNode {
722
+ +type: 'JSXOpeningFragment';
723
+ }
724
+ export interface JSXSpreadAttribute extends BaseNode {
725
+ +type: 'JSXSpreadAttribute';
726
+ +argument: Expression;
727
+ }
728
+ export interface JSXSpreadChild extends BaseNode {
729
+ +type: 'JSXSpreadChild';
730
+ +expression: Expression | JSXEmptyExpression;
731
+ }
732
+ export type JSXTagNameExpression =
733
+ | JSXIdentifier
734
+ | JSXMemberExpression
735
+ | JSXNamespacedName;
736
+ export interface JSXText extends BaseNode {
737
+ +type: 'JSXText';
738
+ +value: string;
739
+ +raw: string;
740
+ }
741
+ export interface JSXTextToken extends BaseToken {
742
+ +type: 'JSXText';
743
+ }
744
+ export interface KeywordToken extends BaseToken {
745
+ +type: 'Keyword';
746
+ }
747
+ export interface LabeledStatement extends BaseNode {
748
+ +type: 'LabeledStatement';
749
+ +label: Identifier;
750
+ +body: Statement;
751
+ }
752
+ export type LeftHandSideExpression =
753
+ | ArrayExpression
754
+ | ArrayPattern
755
+ | ArrowFunctionExpression
756
+ | CallExpression
757
+ | ClassExpression
758
+ | FunctionExpression
759
+ | Identifier
760
+ | JSXElement
761
+ | JSXFragment
762
+ | LiteralExpression
763
+ | MemberExpression
764
+ | MetaProperty
765
+ | ObjectExpression
766
+ | ObjectPattern
767
+ | SequenceExpression
768
+ | Super
769
+ | TaggedTemplateExpression
770
+ | ThisExpression
771
+ | TSAsExpression
772
+ | TSNonNullExpression
773
+ | TSTypeAssertion;
774
+ export interface LineComment extends BaseToken {
775
+ +type: 'Line';
776
+ }
777
+ export type Literal =
778
+ | BigIntLiteral
779
+ | BooleanLiteral
780
+ | NullLiteral
781
+ | NumberLiteral
782
+ | RegExpLiteral
783
+ | StringLiteral;
784
+ interface LiteralBase extends BaseNode {
785
+ +type: 'Literal';
786
+ +raw: string;
787
+ +value: RegExp | /*bigint |*/ boolean | number | string | null;
788
+ }
789
+ export type LiteralExpression = Literal | TemplateLiteral;
790
+ export interface LogicalExpression extends BaseNode {
791
+ +type: 'LogicalExpression';
792
+ +operator: '??' | '&&' | '||';
793
+ +left: Expression;
794
+ +right: Expression;
795
+ }
796
+ export type MemberExpression =
797
+ | MemberExpressionComputedName
798
+ | MemberExpressionNonComputedName;
799
+ interface MemberExpressionBase extends BaseNode {
800
+ +object: LeftHandSideExpression;
801
+ +property: Expression | Identifier | PrivateIdentifier;
802
+ +computed: boolean;
803
+ +optional: boolean;
804
+ }
805
+ export interface MemberExpressionComputedName extends MemberExpressionBase {
806
+ +type: 'MemberExpression';
807
+ +property: Expression;
808
+ +computed: true;
809
+ }
810
+ export interface MemberExpressionNonComputedName extends MemberExpressionBase {
811
+ +type: 'MemberExpression';
812
+ +property: Identifier | PrivateIdentifier;
813
+ +computed: false;
814
+ }
815
+ export interface MetaProperty extends BaseNode {
816
+ +type: 'MetaProperty';
817
+ +meta: Identifier;
818
+ +property: Identifier;
819
+ }
820
+ export type MethodDefinition =
821
+ | MethodDefinitionComputedName
822
+ | MethodDefinitionNonComputedName;
823
+ /** this should not be directly used - instead use MethodDefinitionComputedNameBase or MethodDefinitionNonComputedNameBase */
824
+ interface MethodDefinitionBase extends BaseNode {
825
+ +accessibility?: Accessibility;
826
+ +computed: boolean;
827
+ +decorators?: $ReadOnlyArray<Decorator>;
828
+ +key: PropertyName;
829
+ +kind: 'constructor' | 'get' | 'method' | 'set';
830
+ +optional?: boolean;
831
+ +override?: boolean;
832
+ +static: boolean;
833
+ +typeParameters?: TSTypeParameterDeclaration;
834
+ +value: FunctionExpression | TSEmptyBodyFunctionExpression;
835
+ }
836
+ export interface MethodDefinitionAmbiguous extends MethodDefinitionBase {
837
+ type: 'MethodDefinition';
838
+ }
839
+ export interface MethodDefinitionComputedName
840
+ extends MethodDefinitionComputedNameBase {
841
+ +type: 'MethodDefinition';
842
+ }
843
+ interface MethodDefinitionComputedNameBase extends MethodDefinitionBase {
844
+ +key: PropertyNameComputed;
845
+ +computed: true;
846
+ }
847
+ export interface MethodDefinitionNonComputedName
848
+ extends ClassMethodDefinitionNonComputedNameBase {
849
+ +type: 'MethodDefinition';
850
+ }
851
+ interface MethodDefinitionNonComputedNameBase extends MethodDefinitionBase {
852
+ +key: PropertyNameNonComputed;
853
+ +computed: false;
854
+ }
855
+ export type Modifier =
856
+ | TSAbstractKeyword
857
+ | TSAsyncKeyword
858
+ | TSPrivateKeyword
859
+ | TSProtectedKeyword
860
+ | TSPublicKeyword
861
+ | TSReadonlyKeyword
862
+ | TSStaticKeyword;
863
+ export type NamedExportDeclarations =
864
+ | ClassDeclarationWithName
865
+ | ClassDeclarationWithOptionalName
866
+ | FunctionDeclarationWithName
867
+ | FunctionDeclarationWithOptionalName
868
+ | TSDeclareFunction
869
+ | TSEnumDeclaration
870
+ | TSInterfaceDeclaration
871
+ | TSModuleDeclaration
872
+ | TSTypeAliasDeclaration
873
+ | VariableDeclaration;
874
+ export interface NewExpression extends BaseNode {
875
+ +type: 'NewExpression';
876
+ +callee: LeftHandSideExpression;
877
+ +arguments: $ReadOnlyArray<CallExpressionArgument>;
878
+ +typeParameters?: TSTypeParameterInstantiation;
879
+ }
880
+ export type Node =
881
+ | ArrayExpression
882
+ | ArrayPattern
883
+ | ArrowFunctionExpression
884
+ | AssignmentExpression
885
+ | AssignmentPattern
886
+ | AwaitExpression
887
+ | BinaryExpression
888
+ | BlockStatement
889
+ | BreakStatement
890
+ | CallExpression
891
+ | CatchClause
892
+ | ChainExpression
893
+ | ClassBody
894
+ | ClassDeclaration
895
+ | ClassExpression
896
+ | ConditionalExpression
897
+ | ContinueStatement
898
+ | DebuggerStatement
899
+ | Decorator
900
+ | DoWhileStatement
901
+ | EmptyStatement
902
+ | ExportAllDeclaration
903
+ | ExportDefaultDeclaration
904
+ | ExportNamedDeclaration
905
+ | ExportSpecifier
906
+ | ExpressionStatement
907
+ | ForInStatement
908
+ | ForOfStatement
909
+ | ForStatement
910
+ | FunctionDeclaration
911
+ | FunctionExpression
912
+ | Identifier
913
+ | IfStatement
914
+ | ImportAttribute
915
+ | ImportDeclaration
916
+ | ImportDefaultSpecifier
917
+ | ImportExpression
918
+ | ImportNamespaceSpecifier
919
+ | ImportSpecifier
920
+ | JSXAttribute
921
+ | JSXClosingElement
922
+ | JSXClosingFragment
923
+ | JSXElement
924
+ | JSXEmptyExpression
925
+ | JSXExpressionContainer
926
+ | JSXFragment
927
+ | JSXIdentifier
928
+ | JSXMemberExpression
929
+ | JSXNamespacedName
930
+ | JSXOpeningElement
931
+ | JSXOpeningFragment
932
+ | JSXSpreadAttribute
933
+ | JSXSpreadChild
934
+ | JSXText
935
+ | LabeledStatement
936
+ | Literal
937
+ | LogicalExpression
938
+ | MemberExpression
939
+ | MetaProperty
940
+ | MethodDefinition
941
+ | NewExpression
942
+ | ObjectExpression
943
+ | ObjectPattern
944
+ | PrivateIdentifier
945
+ | Program
946
+ | Property
947
+ | PropertyDefinition
948
+ | RestElement
949
+ | ReturnStatement
950
+ | SequenceExpression
951
+ | SpreadElement
952
+ | StaticBlock
953
+ | Super
954
+ | SwitchCase
955
+ | SwitchStatement
956
+ | TaggedTemplateExpression
957
+ | TemplateElement
958
+ | TemplateLiteral
959
+ | ThisExpression
960
+ | ThrowStatement
961
+ | TryStatement
962
+ | TSAbstractKeyword
963
+ | TSAbstractMethodDefinition
964
+ | TSAbstractPropertyDefinition
965
+ | TSAnyKeyword
966
+ | TSArrayType
967
+ | TSAsExpression
968
+ | TSAsyncKeyword
969
+ | TSBigIntKeyword
970
+ | TSBooleanKeyword
971
+ | TSCallSignatureDeclaration
972
+ | TSClassImplements
973
+ | TSConditionalType
974
+ | TSConstructorType
975
+ | TSConstructSignatureDeclaration
976
+ | TSDeclareFunction
977
+ | TSDeclareKeyword
978
+ | TSEmptyBodyFunctionExpression
979
+ | TSEnumDeclaration
980
+ | TSEnumMember
981
+ | TSExportAssignment
982
+ | TSExportKeyword
983
+ | TSExternalModuleReference
984
+ | TSFunctionType
985
+ | TSImportEqualsDeclaration
986
+ | TSImportType
987
+ | TSIndexedAccessType
988
+ | TSIndexSignature
989
+ | TSInferType
990
+ | TSInstantiationExpression
991
+ | TSInterfaceBody
992
+ | TSInterfaceDeclaration
993
+ | TSInterfaceHeritage
994
+ | TSIntersectionType
995
+ | TSIntrinsicKeyword
996
+ | TSLiteralType
997
+ | TSMappedType
998
+ | TSMethodSignature
999
+ | TSModuleBlock
1000
+ | TSModuleDeclaration
1001
+ | TSNamedTupleMember
1002
+ | TSNamespaceExportDeclaration
1003
+ | TSNeverKeyword
1004
+ | TSNonNullExpression
1005
+ | TSNullKeyword
1006
+ | TSNumberKeyword
1007
+ | TSObjectKeyword
1008
+ | TSOptionalType
1009
+ | TSParameterProperty
1010
+ | TSPrivateKeyword
1011
+ | TSPropertySignature
1012
+ | TSProtectedKeyword
1013
+ | TSPublicKeyword
1014
+ | TSQualifiedName
1015
+ | TSReadonlyKeyword
1016
+ | TSRestType
1017
+ | TSStaticKeyword
1018
+ | TSStringKeyword
1019
+ | TSSymbolKeyword
1020
+ | TSTemplateLiteralType
1021
+ | TSThisType
1022
+ | TSTupleType
1023
+ | TSTypeAliasDeclaration
1024
+ | TSTypeAnnotation
1025
+ | TSTypeAssertion
1026
+ | TSTypeLiteral
1027
+ | TSTypeOperator
1028
+ | TSTypeParameter
1029
+ | TSTypeParameterDeclaration
1030
+ | TSTypeParameterInstantiation
1031
+ | TSTypePredicate
1032
+ | TSTypeQuery
1033
+ | TSTypeReference
1034
+ | TSUndefinedKeyword
1035
+ | TSUnionType
1036
+ | TSUnknownKeyword
1037
+ | TSVoidKeyword
1038
+ | UnaryExpression
1039
+ | UpdateExpression
1040
+ | VariableDeclaration
1041
+ | VariableDeclarator
1042
+ | WhileStatement
1043
+ | WithStatement
1044
+ | YieldExpression
1045
+ // new "ambiguous" nodes
1046
+ | ExportNamedDeclarationAmbiguous;
1047
+ export interface NullLiteral extends LiteralBase {
1048
+ +type: 'Literal';
1049
+ +value: null;
1050
+ +raw: 'null';
1051
+ }
1052
+ export interface NullToken extends BaseToken {
1053
+ +type: 'Null';
1054
+ }
1055
+ export interface NumberLiteral extends LiteralBase {
1056
+ +type: 'Literal';
1057
+ +value: number;
1058
+ }
1059
+ export interface NumericToken extends BaseToken {
1060
+ +type: 'Numeric';
1061
+ }
1062
+ export interface ObjectExpression extends BaseNode {
1063
+ +type: 'ObjectExpression';
1064
+ +properties: $ReadOnlyArray<ObjectLiteralElement>;
1065
+ }
1066
+ export type ObjectLiteralElement = MethodDefinition | Property | SpreadElement;
1067
+ export type ObjectLiteralElementLike = ObjectLiteralElement;
1068
+ export interface ObjectPattern extends BaseNode {
1069
+ +type: 'ObjectPattern';
1070
+ +properties: $ReadOnlyArray<Property | RestElement>;
1071
+ +typeAnnotation?: TSTypeAnnotation;
1072
+ +optional?: boolean;
1073
+ +decorators?: $ReadOnlyArray<Decorator>;
1074
+ }
1075
+ export type Parameter =
1076
+ | ArrayPattern
1077
+ | AssignmentPattern
1078
+ | Identifier
1079
+ | ObjectPattern
1080
+ | RestElement
1081
+ | TSParameterProperty;
1082
+ export interface Position {
1083
+ /**
1084
+ * Line number (1-indexed)
1085
+ */
1086
+ +line: number;
1087
+ /**
1088
+ * Column number on the line (0-indexed)
1089
+ */
1090
+ +column: number;
1091
+ }
1092
+ export type PrimaryExpression =
1093
+ | ArrayExpression
1094
+ | ArrayPattern
1095
+ | ClassExpression
1096
+ | FunctionExpression
1097
+ | Identifier
1098
+ | JSXElement
1099
+ | JSXFragment
1100
+ | JSXOpeningElement
1101
+ | LiteralExpression
1102
+ | MetaProperty
1103
+ | ObjectExpression
1104
+ | ObjectPattern
1105
+ | Super
1106
+ | TemplateLiteral
1107
+ | ThisExpression
1108
+ | TSNullKeyword;
1109
+ export interface PrivateIdentifier extends BaseNode {
1110
+ +type: 'PrivateIdentifier';
1111
+ +name: string;
1112
+ }
1113
+ export interface Program extends BaseNode {
1114
+ +type: 'Program';
1115
+ +body: $ReadOnlyArray<ProgramStatement>;
1116
+ +sourceType: 'module' | 'script';
1117
+ +comments?: $ReadOnlyArray<Comment>;
1118
+ +tokens?: $ReadOnlyArray<Token>;
1119
+ }
1120
+ export type ProgramStatement =
1121
+ | ExportAllDeclaration
1122
+ | ExportDefaultDeclaration
1123
+ | ExportNamedDeclaration
1124
+ | ImportDeclaration
1125
+ | Statement
1126
+ | TSImportEqualsDeclaration
1127
+ | TSNamespaceExportDeclaration;
1128
+ export type Property = PropertyComputedName | PropertyNonComputedName;
1129
+ interface PropertyBase extends BaseNode {
1130
+ +type: 'Property';
1131
+ +key: PropertyName;
1132
+ +value:
1133
+ | AssignmentPattern
1134
+ | BindingName
1135
+ | Expression
1136
+ | TSEmptyBodyFunctionExpression;
1137
+ +computed: boolean;
1138
+ +method: boolean;
1139
+ +shorthand: boolean;
1140
+ +optional?: boolean;
1141
+ +kind: 'get' | 'init' | 'set';
1142
+ }
1143
+ export interface PropertyComputedName extends PropertyBase {
1144
+ +type: 'Property';
1145
+ +key: PropertyNameComputed;
1146
+ +computed: true;
1147
+ }
1148
+ export type PropertyDefinition =
1149
+ | PropertyDefinitionComputedName
1150
+ | PropertyDefinitionNonComputedName;
1151
+ interface PropertyDefinitionBase extends BaseNode {
1152
+ +accessibility?: Accessibility;
1153
+ +computed: boolean;
1154
+ +declare: boolean;
1155
+ +decorators?: $ReadOnlyArray<Decorator>;
1156
+ +definite?: boolean;
1157
+ +key: PropertyName;
1158
+ +optional?: boolean;
1159
+ +override?: boolean;
1160
+ +readonly?: boolean;
1161
+ +static: boolean;
1162
+ +typeAnnotation?: TSTypeAnnotation;
1163
+ +value: Expression | null;
1164
+ }
1165
+ export interface PropertyDefinitionAmbiguous extends PropertyDefinitionBase {
1166
+ type: 'PropertyDefinition';
1167
+ }
1168
+ export interface PropertyDefinitionComputedName
1169
+ extends PropertyDefinitionComputedNameBase {
1170
+ +type: 'PropertyDefinition';
1171
+ }
1172
+ interface PropertyDefinitionComputedNameBase extends PropertyDefinitionBase {
1173
+ +key: PropertyNameComputed;
1174
+ +computed: true;
1175
+ }
1176
+ export interface PropertyDefinitionNonComputedName
1177
+ extends ClassPropertyDefinitionNonComputedNameBase {
1178
+ +type: 'PropertyDefinition';
1179
+ }
1180
+ interface PropertyDefinitionNonComputedNameBase extends PropertyDefinitionBase {
1181
+ +key: PropertyNameNonComputed;
1182
+ +computed: false;
1183
+ }
1184
+ export type PropertyName =
1185
+ | ClassPropertyNameNonComputed
1186
+ | PropertyNameComputed
1187
+ | PropertyNameNonComputed;
1188
+ export type PropertyNameComputed = Expression;
1189
+ export type PropertyNameNonComputed =
1190
+ | Identifier
1191
+ | NumberLiteral
1192
+ | StringLiteral;
1193
+ export interface PropertyNonComputedName extends PropertyBase {
1194
+ +type: 'Property';
1195
+ +key: PropertyNameNonComputed;
1196
+ +computed: false;
1197
+ }
1198
+ export interface PunctuatorToken extends BaseToken {
1199
+ +type: 'Punctuator';
1200
+ +value:
1201
+ | '{'
1202
+ | '}'
1203
+ | '('
1204
+ | ')'
1205
+ | '['
1206
+ | ']'
1207
+ | '.'
1208
+ | '...'
1209
+ | ';'
1210
+ | ','
1211
+ | '?.'
1212
+ | '<'
1213
+ | '</'
1214
+ | '>'
1215
+ | '<='
1216
+ | '>='
1217
+ | '=='
1218
+ | '!='
1219
+ | '==='
1220
+ | '!=='
1221
+ | '=>'
1222
+ | '+'
1223
+ | '-'
1224
+ | '*'
1225
+ | '**'
1226
+ | '/'
1227
+ | '%'
1228
+ | '++'
1229
+ | '--'
1230
+ | '<<'
1231
+ | '>>'
1232
+ | '>>>'
1233
+ | '&'
1234
+ | '|'
1235
+ | '^'
1236
+ | '!'
1237
+ | '~'
1238
+ | '&&'
1239
+ | '||'
1240
+ | '?'
1241
+ | ':'
1242
+ | '@'
1243
+ | '??'
1244
+ | '`'
1245
+ | '#';
1246
+ }
1247
+ /**
1248
+ * An array of two numbers.
1249
+ * Both numbers are a 0-based index which is the position in the array of source code characters.
1250
+ * The first is the start position of the node, the second is the end position of the node.
1251
+ */
1252
+ export type Range = [number, number];
1253
+ export interface RegExpLiteral extends LiteralBase {
1254
+ +type: 'Literal';
1255
+ +value: RegExp | null;
1256
+ +regex: {
1257
+ +pattern: string,
1258
+ +flags: string,
1259
+ };
1260
+ }
1261
+ export interface RegularExpressionToken extends BaseToken {
1262
+ +type: 'RegularExpression';
1263
+ +regex: {
1264
+ +pattern: string,
1265
+ +flags: string,
1266
+ };
1267
+ }
1268
+ export interface RestElement extends BaseNode {
1269
+ +type: 'RestElement';
1270
+ +argument: DestructuringPattern;
1271
+ +typeAnnotation?: TSTypeAnnotation;
1272
+ +optional?: boolean;
1273
+ +value?: AssignmentPattern;
1274
+ +decorators?: $ReadOnlyArray<Decorator>;
1275
+ }
1276
+ export interface ReturnStatement extends BaseNode {
1277
+ +type: 'ReturnStatement';
1278
+ +argument: Expression | null;
1279
+ }
1280
+ export interface SequenceExpression extends BaseNode {
1281
+ +type: 'SequenceExpression';
1282
+ +expressions: $ReadOnlyArray<Expression>;
1283
+ }
1284
+ export interface SourceLocation {
1285
+ /**
1286
+ * The position of the first character of the parsed source region
1287
+ */
1288
+ +start: Position;
1289
+ /**
1290
+ * The position of the first character after the parsed source region
1291
+ */
1292
+ +end: Position;
1293
+ }
1294
+ export interface SpreadElement extends BaseNode {
1295
+ +type: 'SpreadElement';
1296
+ +argument: Expression;
1297
+ }
1298
+ export type Statement =
1299
+ | BlockStatement
1300
+ | BreakStatement
1301
+ | ClassDeclarationWithName
1302
+ | ContinueStatement
1303
+ | DebuggerStatement
1304
+ | DoWhileStatement
1305
+ | ExportAllDeclaration
1306
+ | ExportDefaultDeclaration
1307
+ | ExportNamedDeclaration
1308
+ | ExpressionStatement
1309
+ | ForInStatement
1310
+ | ForOfStatement
1311
+ | ForStatement
1312
+ | FunctionDeclarationWithName
1313
+ | IfStatement
1314
+ | ImportDeclaration
1315
+ | LabeledStatement
1316
+ | ReturnStatement
1317
+ | SwitchStatement
1318
+ | ThrowStatement
1319
+ | TryStatement
1320
+ | TSDeclareFunction
1321
+ | TSEnumDeclaration
1322
+ | TSExportAssignment
1323
+ | TSImportEqualsDeclaration
1324
+ | TSInterfaceDeclaration
1325
+ | TSModuleDeclaration
1326
+ | TSNamespaceExportDeclaration
1327
+ | TSTypeAliasDeclaration
1328
+ | VariableDeclaration
1329
+ | WhileStatement
1330
+ | WithStatement;
1331
+ export interface StaticBlock extends BaseNode {
1332
+ +type: 'StaticBlock';
1333
+ +body: $ReadOnlyArray<Statement>;
1334
+ }
1335
+ export interface StringLiteral extends LiteralBase {
1336
+ +type: 'Literal';
1337
+ +value: string;
1338
+ }
1339
+ export interface StringToken extends BaseToken {
1340
+ +type: 'String';
1341
+ }
1342
+ export interface Super extends BaseNode {
1343
+ +type: 'Super';
1344
+ }
1345
+ export interface SwitchCase extends BaseNode {
1346
+ +type: 'SwitchCase';
1347
+ +test: Expression | null;
1348
+ +consequent: $ReadOnlyArray<Statement>;
1349
+ }
1350
+ export interface SwitchStatement extends BaseNode {
1351
+ +type: 'SwitchStatement';
1352
+ +discriminant: Expression;
1353
+ +cases: $ReadOnlyArray<SwitchCase>;
1354
+ }
1355
+ export interface TaggedTemplateExpression extends BaseNode {
1356
+ +type: 'TaggedTemplateExpression';
1357
+ +typeParameters?: TSTypeParameterInstantiation;
1358
+ +tag: LeftHandSideExpression;
1359
+ +quasi: TemplateLiteral;
1360
+ }
1361
+ export interface TemplateElement extends BaseNode {
1362
+ +type: 'TemplateElement';
1363
+ +value: {
1364
+ raw: string,
1365
+ cooked: string,
1366
+ };
1367
+ +tail: boolean;
1368
+ }
1369
+ export interface TemplateLiteral extends BaseNode {
1370
+ +type: 'TemplateLiteral';
1371
+ +quasis: $ReadOnlyArray<TemplateElement>;
1372
+ +expressions: $ReadOnlyArray<Expression>;
1373
+ }
1374
+ export interface TemplateToken extends BaseToken {
1375
+ +type: 'Template';
1376
+ }
1377
+ export interface ThisExpression extends BaseNode {
1378
+ +type: 'ThisExpression';
1379
+ }
1380
+ export interface ThrowStatement extends BaseNode {
1381
+ +type: 'ThrowStatement';
1382
+ +argument: Statement | TSAsExpression | null;
1383
+ }
1384
+ export type Token =
1385
+ | BooleanToken
1386
+ | Comment
1387
+ | IdentifierToken
1388
+ | JSXIdentifierToken
1389
+ | JSXTextToken
1390
+ | KeywordToken
1391
+ | NullToken
1392
+ | NumericToken
1393
+ | PunctuatorToken
1394
+ | RegularExpressionToken
1395
+ | StringToken
1396
+ | TemplateToken;
1397
+ export interface TryStatement extends BaseNode {
1398
+ +type: 'TryStatement';
1399
+ +block: BlockStatement;
1400
+ +handler: CatchClause | null;
1401
+ +finalizer: BlockStatement | null;
1402
+ }
1403
+ export interface TSAbstractKeyword extends BaseNode {
1404
+ +type: 'TSAbstractKeyword';
1405
+ }
1406
+ export type TSAbstractMethodDefinition =
1407
+ | TSAbstractMethodDefinitionComputedName
1408
+ | TSAbstractMethodDefinitionNonComputedName;
1409
+ export interface TSAbstractMethodDefinitionComputedName
1410
+ extends MethodDefinitionComputedNameBase {
1411
+ +type: 'TSAbstractMethodDefinition';
1412
+ }
1413
+ export interface TSAbstractMethodDefinitionNonComputedName
1414
+ extends MethodDefinitionNonComputedNameBase {
1415
+ +type: 'TSAbstractMethodDefinition';
1416
+ }
1417
+ export type TSAbstractPropertyDefinition =
1418
+ | TSAbstractPropertyDefinitionComputedName
1419
+ | TSAbstractPropertyDefinitionNonComputedName;
1420
+ export interface TSAbstractPropertyDefinitionComputedName
1421
+ extends PropertyDefinitionComputedNameBase {
1422
+ +type: 'TSAbstractPropertyDefinition';
1423
+ +value: null;
1424
+ }
1425
+ export interface TSAbstractPropertyDefinitionNonComputedName
1426
+ extends PropertyDefinitionNonComputedNameBase {
1427
+ +type: 'TSAbstractPropertyDefinition';
1428
+ +value: null;
1429
+ }
1430
+ export interface TSAnyKeyword extends BaseNode {
1431
+ +type: 'TSAnyKeyword';
1432
+ }
1433
+ export interface TSArrayType extends BaseNode {
1434
+ +type: 'TSArrayType';
1435
+ +elementType: TypeNode;
1436
+ }
1437
+ export interface TSAsExpression extends BaseNode {
1438
+ +type: 'TSAsExpression';
1439
+ +expression: Expression;
1440
+ +typeAnnotation: TypeNode;
1441
+ }
1442
+ export interface TSAsyncKeyword extends BaseNode {
1443
+ +type: 'TSAsyncKeyword';
1444
+ }
1445
+ export interface TSBigIntKeyword extends BaseNode {
1446
+ +type: 'TSBigIntKeyword';
1447
+ }
1448
+ export interface TSBooleanKeyword extends BaseNode {
1449
+ +type: 'TSBooleanKeyword';
1450
+ }
1451
+ export interface TSCallSignatureDeclaration extends TSFunctionSignatureBase {
1452
+ +type: 'TSCallSignatureDeclaration';
1453
+ }
1454
+ export interface TSClassImplements extends TSHeritageBase {
1455
+ +type: 'TSClassImplements';
1456
+ }
1457
+ export interface TSConditionalType extends BaseNode {
1458
+ +type: 'TSConditionalType';
1459
+ +checkType: TypeNode;
1460
+ +extendsType: TypeNode;
1461
+ +trueType: TypeNode;
1462
+ +falseType: TypeNode;
1463
+ }
1464
+ export interface TSConstructorType extends TSFunctionSignatureBase {
1465
+ +type: 'TSConstructorType';
1466
+ +abstract: boolean;
1467
+ }
1468
+ export interface TSConstructSignatureDeclaration
1469
+ extends TSFunctionSignatureBase {
1470
+ +type: 'TSConstructSignatureDeclaration';
1471
+ }
1472
+ export interface TSDeclareFunction extends FunctionBase {
1473
+ +type: 'TSDeclareFunction';
1474
+ +body?: BlockStatement;
1475
+ +declare?: boolean;
1476
+ +expression: false;
1477
+ }
1478
+ export interface TSDeclareKeyword extends BaseNode {
1479
+ +type: 'TSDeclareKeyword';
1480
+ }
1481
+ export interface TSEmptyBodyFunctionExpression extends FunctionBase {
1482
+ +type: 'TSEmptyBodyFunctionExpression';
1483
+ +body: null;
1484
+ +id: null;
1485
+ }
1486
+ export interface TSEnumDeclaration extends BaseNode {
1487
+ +type: 'TSEnumDeclaration';
1488
+ /**
1489
+ * Whether this is a `const` enum.
1490
+ * ```
1491
+ * const enum Foo {...}
1492
+ * ```
1493
+ */
1494
+ +const?: boolean;
1495
+ /**
1496
+ * Whether this is a `declare`d enum.
1497
+ * ```
1498
+ * declare enum Foo {...}
1499
+ * ```
1500
+ */
1501
+ +declare?: boolean;
1502
+ /**
1503
+ * The enum name.
1504
+ */
1505
+ +id: Identifier;
1506
+ /**
1507
+ * The enum members.
1508
+ */
1509
+ +members: $ReadOnlyArray<TSEnumMember>;
1510
+ +modifiers?: $ReadOnlyArray<Modifier>;
1511
+ }
1512
+ export type TSEnumMember =
1513
+ | TSEnumMemberComputedName
1514
+ | TSEnumMemberNonComputedName;
1515
+ interface TSEnumMemberBase extends BaseNode {
1516
+ +type: 'TSEnumMember';
1517
+ +id: PropertyNameComputed | PropertyNameNonComputed;
1518
+ +initializer?: Expression;
1519
+ +computed?: boolean;
1520
+ }
1521
+ /**
1522
+ * this should only really happen in semantically invalid code (errors 1164 and 2452)
1523
+ *
1524
+ * VALID:
1525
+ * enum Foo { ['a'] }
1526
+ *
1527
+ * INVALID:
1528
+ * const x = 'a';
1529
+ * enum Foo { [x] }
1530
+ * enum Bar { ['a' + 'b'] }
1531
+ */
1532
+ export interface TSEnumMemberComputedName extends TSEnumMemberBase {
1533
+ +type: 'TSEnumMember';
1534
+ +id: PropertyNameComputed;
1535
+ +computed: true;
1536
+ }
1537
+ export interface TSEnumMemberNonComputedName extends TSEnumMemberBase {
1538
+ +type: 'TSEnumMember';
1539
+ +id: PropertyNameNonComputed;
1540
+ +computed?: false;
1541
+ }
1542
+ export interface TSExportAssignment extends BaseNode {
1543
+ +type: 'TSExportAssignment';
1544
+ +expression: Expression;
1545
+ }
1546
+ export interface TSExportKeyword extends BaseNode {
1547
+ +type: 'TSExportKeyword';
1548
+ }
1549
+ export interface TSExternalModuleReference extends BaseNode {
1550
+ +type: 'TSExternalModuleReference';
1551
+ +expression: Expression;
1552
+ }
1553
+ interface TSFunctionSignatureBase extends BaseNode {
1554
+ +params: $ReadOnlyArray<Parameter>;
1555
+ +returnType?: TSTypeAnnotation;
1556
+ +typeParameters?: TSTypeParameterDeclaration;
1557
+ }
1558
+ export interface TSFunctionType extends TSFunctionSignatureBase {
1559
+ +type: 'TSFunctionType';
1560
+ }
1561
+ interface TSHeritageBase extends BaseNode {
1562
+ +expression: Expression;
1563
+ +typeParameters?: TSTypeParameterInstantiation;
1564
+ }
1565
+ export interface TSImportEqualsDeclaration extends BaseNode {
1566
+ +type: 'TSImportEqualsDeclaration';
1567
+ /**
1568
+ * The locally imported name
1569
+ */
1570
+ +id: Identifier;
1571
+ /**
1572
+ * The value being aliased.
1573
+ * ```
1574
+ * import F1 = A;
1575
+ * import F2 = A.B.C;
1576
+ * import F3 = require('mod');
1577
+ * ```
1578
+ */
1579
+ +moduleReference: EntityName | TSExternalModuleReference;
1580
+ +importKind: ImportKind;
1581
+ /**
1582
+ * Whether this is immediately exported
1583
+ * ```
1584
+ * export import F = A;
1585
+ * ```
1586
+ */
1587
+ +isExport: boolean;
1588
+ }
1589
+ export interface TSImportType extends BaseNode {
1590
+ +type: 'TSImportType';
1591
+ +isTypeOf: boolean;
1592
+ +parameter: TypeNode;
1593
+ +qualifier: EntityName | null;
1594
+ +typeParameters: TSTypeParameterInstantiation | null;
1595
+ }
1596
+ export interface TSIndexedAccessType extends BaseNode {
1597
+ +type: 'TSIndexedAccessType';
1598
+ +objectType: TypeNode;
1599
+ +indexType: TypeNode;
1600
+ }
1601
+ export interface TSIndexSignature extends BaseNode {
1602
+ +type: 'TSIndexSignature';
1603
+ +accessibility?: Accessibility;
1604
+ +export?: boolean;
1605
+ +parameters: $ReadOnlyArray<Parameter>;
1606
+ +readonly?: boolean;
1607
+ +static?: boolean;
1608
+ +typeAnnotation?: TSTypeAnnotation;
1609
+ }
1610
+ export interface TSInferType extends BaseNode {
1611
+ +type: 'TSInferType';
1612
+ +typeParameter: TSTypeParameter;
1613
+ }
1614
+ export interface TSInstantiationExpression extends BaseNode {
1615
+ +type: 'TSInstantiationExpression';
1616
+ +expression: Expression;
1617
+ +typeParameters: TSTypeParameterInstantiation;
1618
+ }
1619
+ export interface TSInterfaceBody extends BaseNode {
1620
+ +type: 'TSInterfaceBody';
1621
+ +body: $ReadOnlyArray<TypeElement>;
1622
+ }
1623
+ export interface TSInterfaceDeclaration extends BaseNode {
1624
+ +type: 'TSInterfaceDeclaration';
1625
+ +abstract?: boolean;
1626
+ /**
1627
+ * The body of the interface
1628
+ */
1629
+ +body: TSInterfaceBody;
1630
+ /**
1631
+ * Whether the interface was `declare`d, `undefined` otherwise
1632
+ */
1633
+ +declare?: boolean;
1634
+ /**
1635
+ * The types this interface `extends`
1636
+ */
1637
+ +extends?: $ReadOnlyArray<TSInterfaceHeritage>;
1638
+ /**
1639
+ * The name of this interface
1640
+ */
1641
+ +id: Identifier;
1642
+ +implements?: $ReadOnlyArray<TSInterfaceHeritage>;
1643
+ /**
1644
+ * The generic type parameters declared for the interface.
1645
+ * This is `undefined` if there are no generic type parameters declared.
1646
+ */
1647
+ +typeParameters?: TSTypeParameterDeclaration;
1648
+ }
1649
+ export interface TSInterfaceHeritage extends TSHeritageBase {
1650
+ +type: 'TSInterfaceHeritage';
1651
+ }
1652
+ export interface TSIntersectionType extends BaseNode {
1653
+ +type: 'TSIntersectionType';
1654
+ +types: $ReadOnlyArray<TypeNode>;
1655
+ }
1656
+ export interface TSIntrinsicKeyword extends BaseNode {
1657
+ +type: 'TSIntrinsicKeyword';
1658
+ }
1659
+ export interface TSLiteralType extends BaseNode {
1660
+ +type: 'TSLiteralType';
1661
+ +literal: LiteralExpression | UnaryExpression | UpdateExpression;
1662
+ }
1663
+ export interface TSMappedType extends BaseNode {
1664
+ +type: 'TSMappedType';
1665
+ +typeParameter: TSTypeParameter;
1666
+ +readonly?: boolean | '-' | '+';
1667
+ +optional?: boolean | '-' | '+';
1668
+ +typeAnnotation?: TypeNode;
1669
+ +nameType: TypeNode | null;
1670
+ }
1671
+ export type TSMethodSignature =
1672
+ | TSMethodSignatureComputedName
1673
+ | TSMethodSignatureNonComputedName;
1674
+ interface TSMethodSignatureBase extends BaseNode {
1675
+ +type: 'TSMethodSignature';
1676
+ +accessibility?: Accessibility;
1677
+ +computed: boolean;
1678
+ +export?: boolean;
1679
+ +key: PropertyName;
1680
+ +kind: 'get' | 'method' | 'set';
1681
+ +optional?: boolean;
1682
+ +params: $ReadOnlyArray<Parameter>;
1683
+ +readonly?: boolean;
1684
+ +returnType?: TSTypeAnnotation;
1685
+ +static?: boolean;
1686
+ +typeParameters?: TSTypeParameterDeclaration;
1687
+ }
1688
+ export interface TSMethodSignatureComputedName extends TSMethodSignatureBase {
1689
+ +type: 'TSMethodSignature';
1690
+ +key: PropertyNameComputed;
1691
+ +computed: true;
1692
+ }
1693
+ export interface TSMethodSignatureNonComputedName
1694
+ extends TSMethodSignatureBase {
1695
+ +type: 'TSMethodSignature';
1696
+ +key: PropertyNameNonComputed;
1697
+ +computed: false;
1698
+ }
1699
+ export interface TSModuleBlock extends BaseNode {
1700
+ +type: 'TSModuleBlock';
1701
+ +body: $ReadOnlyArray<ProgramStatement>;
1702
+ }
1703
+ export interface TSModuleDeclaration extends BaseNode {
1704
+ +type: 'TSModuleDeclaration';
1705
+ /**
1706
+ * The name of the module
1707
+ * ```
1708
+ * namespace A {}
1709
+ * namespace A.B.C {}
1710
+ * module 'a' {}
1711
+ * ```
1712
+ */
1713
+ +id: Identifier | Literal;
1714
+ /**
1715
+ * The body of the module.
1716
+ * This can only be `undefined` for the code `declare module 'mod';`
1717
+ * This will be a `TSModuleDeclaration` if the name is "nested" (`Foo.Bar`).
1718
+ */
1719
+ +body?: TSModuleBlock | TSModuleDeclaration;
1720
+ /**
1721
+ * Whether this is a global declaration
1722
+ * ```
1723
+ * declare global {}
1724
+ * ```
1725
+ */
1726
+ +global?: boolean;
1727
+ /**
1728
+ * Whether the module is `declare`d
1729
+ * ```
1730
+ * declare namespace F {}
1731
+ * ```
1732
+ */
1733
+ +declare?: boolean;
1734
+ +modifiers?: $ReadOnlyArray<Modifier>;
1735
+ }
1736
+ export interface TSNamedTupleMember extends BaseNode {
1737
+ +type: 'TSNamedTupleMember';
1738
+ +elementType: TypeNode;
1739
+ +label: Identifier;
1740
+ +optional: boolean;
1741
+ }
1742
+ export interface TSNamespaceExportDeclaration extends BaseNode {
1743
+ +type: 'TSNamespaceExportDeclaration';
1744
+ /**
1745
+ * The name the global variable being exported to
1746
+ */
1747
+ +id: Identifier;
1748
+ }
1749
+ export interface TSNeverKeyword extends BaseNode {
1750
+ +type: 'TSNeverKeyword';
1751
+ }
1752
+ export interface TSNonNullExpression extends BaseNode {
1753
+ +type: 'TSNonNullExpression';
1754
+ +expression: Expression;
1755
+ }
1756
+ export interface TSNullKeyword extends BaseNode {
1757
+ +type: 'TSNullKeyword';
1758
+ }
1759
+ export interface TSNumberKeyword extends BaseNode {
1760
+ +type: 'TSNumberKeyword';
1761
+ }
1762
+ export interface TSObjectKeyword extends BaseNode {
1763
+ +type: 'TSObjectKeyword';
1764
+ }
1765
+ export interface TSOptionalType extends BaseNode {
1766
+ +type: 'TSOptionalType';
1767
+ +typeAnnotation: TypeNode;
1768
+ }
1769
+ export interface TSParameterProperty extends BaseNode {
1770
+ +type: 'TSParameterProperty';
1771
+ +accessibility?: Accessibility;
1772
+ +readonly?: boolean;
1773
+ +static?: boolean;
1774
+ +export?: boolean;
1775
+ +override?: boolean;
1776
+ +parameter: AssignmentPattern | BindingName | RestElement;
1777
+ +decorators?: $ReadOnlyArray<Decorator>;
1778
+ }
1779
+ export interface TSPrivateKeyword extends BaseNode {
1780
+ +type: 'TSPrivateKeyword';
1781
+ }
1782
+ export type TSPropertySignature =
1783
+ | TSPropertySignatureComputedName
1784
+ | TSPropertySignatureNonComputedName;
1785
+ interface TSPropertySignatureBase extends BaseNode {
1786
+ +type: 'TSPropertySignature';
1787
+ +accessibility?: Accessibility;
1788
+ +computed: boolean;
1789
+ +export?: boolean;
1790
+ +initializer?: Expression;
1791
+ +key: PropertyName;
1792
+ +optional?: boolean;
1793
+ +readonly?: boolean;
1794
+ +static?: boolean;
1795
+ +typeAnnotation?: TSTypeAnnotation;
1796
+ }
1797
+ export interface TSPropertySignatureComputedName
1798
+ extends TSPropertySignatureBase {
1799
+ +type: 'TSPropertySignature';
1800
+ +key: PropertyNameComputed;
1801
+ +computed: true;
1802
+ }
1803
+ export interface TSPropertySignatureNonComputedName
1804
+ extends TSPropertySignatureBase {
1805
+ +type: 'TSPropertySignature';
1806
+ +key: PropertyNameNonComputed;
1807
+ +computed: false;
1808
+ }
1809
+ export interface TSProtectedKeyword extends BaseNode {
1810
+ +type: 'TSProtectedKeyword';
1811
+ }
1812
+ export interface TSPublicKeyword extends BaseNode {
1813
+ +type: 'TSPublicKeyword';
1814
+ }
1815
+ export interface TSQualifiedName extends BaseNode {
1816
+ +type: 'TSQualifiedName';
1817
+ +left: EntityName;
1818
+ +right: Identifier;
1819
+ }
1820
+ export interface TSReadonlyKeyword extends BaseNode {
1821
+ +type: 'TSReadonlyKeyword';
1822
+ }
1823
+ export interface TSRestType extends BaseNode {
1824
+ +type: 'TSRestType';
1825
+ +typeAnnotation: TypeNode;
1826
+ }
1827
+ export interface TSStaticKeyword extends BaseNode {
1828
+ +type: 'TSStaticKeyword';
1829
+ }
1830
+ export interface TSStringKeyword extends BaseNode {
1831
+ +type: 'TSStringKeyword';
1832
+ }
1833
+ export interface TSSymbolKeyword extends BaseNode {
1834
+ +type: 'TSSymbolKeyword';
1835
+ }
1836
+ export interface TSTemplateLiteralType extends BaseNode {
1837
+ +type: 'TSTemplateLiteralType';
1838
+ +quasis: $ReadOnlyArray<TemplateElement>;
1839
+ +types: $ReadOnlyArray<TypeNode>;
1840
+ }
1841
+ export interface TSThisType extends BaseNode {
1842
+ +type: 'TSThisType';
1843
+ }
1844
+ export interface TSTupleType extends BaseNode {
1845
+ +type: 'TSTupleType';
1846
+ +elementTypes: $ReadOnlyArray<TypeNode>;
1847
+ }
1848
+ export interface TSTypeAliasDeclaration extends BaseNode {
1849
+ +type: 'TSTypeAliasDeclaration';
1850
+ /**
1851
+ * Whether the type was `declare`d.
1852
+ * ```
1853
+ * declare type T = 1;
1854
+ * ```
1855
+ */
1856
+ +declare?: boolean;
1857
+ /**
1858
+ * The name of the type.
1859
+ */
1860
+ +id: Identifier;
1861
+ /**
1862
+ * The "value" (type) of the declaration
1863
+ */
1864
+ +typeAnnotation: TypeNode;
1865
+ /**
1866
+ * The generic type parameters declared for the type.
1867
+ * This is `undefined` if there are no generic type parameters declared.
1868
+ */
1869
+ +typeParameters?: TSTypeParameterDeclaration;
1870
+ }
1871
+ export interface TSTypeAnnotation extends BaseNode {
1872
+ +type: 'TSTypeAnnotation';
1873
+ +typeAnnotation: TypeNode;
1874
+ }
1875
+ export interface TSTypeAssertion extends BaseNode {
1876
+ +type: 'TSTypeAssertion';
1877
+ +typeAnnotation: TypeNode;
1878
+ +expression: Expression;
1879
+ }
1880
+ export interface TSTypeLiteral extends BaseNode {
1881
+ +type: 'TSTypeLiteral';
1882
+ +members: $ReadOnlyArray<TypeElement>;
1883
+ }
1884
+ export interface TSTypeOperator extends BaseNode {
1885
+ +type: 'TSTypeOperator';
1886
+ +operator: 'keyof' | 'readonly' | 'unique';
1887
+ +typeAnnotation?: TypeNode;
1888
+ }
1889
+ export interface TSTypeParameter extends BaseNode {
1890
+ +type: 'TSTypeParameter';
1891
+ +name: Identifier;
1892
+ +constraint?: TypeNode;
1893
+ +default?: TypeNode;
1894
+ +in: boolean;
1895
+ +out: boolean;
1896
+ }
1897
+ export interface TSTypeParameterDeclaration extends BaseNode {
1898
+ +type: 'TSTypeParameterDeclaration';
1899
+ +params: $ReadOnlyArray<TSTypeParameter>;
1900
+ }
1901
+ export interface TSTypeParameterInstantiation extends BaseNode {
1902
+ +type: 'TSTypeParameterInstantiation';
1903
+ +params: $ReadOnlyArray<TypeNode>;
1904
+ }
1905
+ export interface TSTypePredicate extends BaseNode {
1906
+ +type: 'TSTypePredicate';
1907
+ +asserts: boolean;
1908
+ +parameterName: Identifier | TSThisType;
1909
+ +typeAnnotation: TSTypeAnnotation | null;
1910
+ }
1911
+ export interface TSTypeQuery extends BaseNode {
1912
+ +type: 'TSTypeQuery';
1913
+ +exprName: EntityName;
1914
+ +typeParameters?: TSTypeParameterInstantiation;
1915
+ }
1916
+ export interface TSTypeReference extends BaseNode {
1917
+ +type: 'TSTypeReference';
1918
+ +typeName: EntityName;
1919
+ +typeParameters?: TSTypeParameterInstantiation;
1920
+ }
1921
+ export type TSUnaryExpression =
1922
+ | AwaitExpression
1923
+ | LeftHandSideExpression
1924
+ | UnaryExpression
1925
+ | UpdateExpression;
1926
+ export interface TSUndefinedKeyword extends BaseNode {
1927
+ +type: 'TSUndefinedKeyword';
1928
+ }
1929
+ export interface TSUnionType extends BaseNode {
1930
+ +type: 'TSUnionType';
1931
+ +types: $ReadOnlyArray<TypeNode>;
1932
+ }
1933
+ export interface TSUnknownKeyword extends BaseNode {
1934
+ +type: 'TSUnknownKeyword';
1935
+ }
1936
+ export interface TSVoidKeyword extends BaseNode {
1937
+ +type: 'TSVoidKeyword';
1938
+ }
1939
+ export type TypeElement =
1940
+ | TSCallSignatureDeclaration
1941
+ | TSConstructSignatureDeclaration
1942
+ | TSIndexSignature
1943
+ | TSMethodSignature
1944
+ | TSPropertySignature;
1945
+ export type TypeNode =
1946
+ | TSAbstractKeyword
1947
+ | TSAnyKeyword
1948
+ | TSArrayType
1949
+ | TSAsyncKeyword
1950
+ | TSBigIntKeyword
1951
+ | TSBooleanKeyword
1952
+ | TSConditionalType
1953
+ | TSConstructorType
1954
+ | TSDeclareKeyword
1955
+ | TSExportKeyword
1956
+ | TSFunctionType
1957
+ | TSImportType
1958
+ | TSIndexedAccessType
1959
+ | TSInferType
1960
+ | TSIntersectionType
1961
+ | TSIntrinsicKeyword
1962
+ | TSLiteralType
1963
+ | TSMappedType
1964
+ | TSNamedTupleMember
1965
+ | TSNeverKeyword
1966
+ | TSNullKeyword
1967
+ | TSNumberKeyword
1968
+ | TSObjectKeyword
1969
+ | TSOptionalType
1970
+ | TSQualifiedName
1971
+ | TSPrivateKeyword
1972
+ | TSProtectedKeyword
1973
+ | TSPublicKeyword
1974
+ | TSReadonlyKeyword
1975
+ | TSRestType
1976
+ | TSStaticKeyword
1977
+ | TSStringKeyword
1978
+ | TSSymbolKeyword
1979
+ | TSTemplateLiteralType
1980
+ | TSThisType
1981
+ | TSTupleType
1982
+ | TSTypeLiteral
1983
+ | TSTypeOperator
1984
+ | TSTypePredicate
1985
+ | TSTypeQuery
1986
+ | TSTypeReference
1987
+ | TSUndefinedKeyword
1988
+ | TSUnionType
1989
+ | TSUnknownKeyword
1990
+ | TSVoidKeyword;
1991
+ export interface UnaryExpression extends UnaryExpressionBase {
1992
+ +type: 'UnaryExpression';
1993
+ +operator: '-' | '!' | '+' | '~' | 'delete' | 'typeof' | 'void';
1994
+ }
1995
+ interface UnaryExpressionBase extends BaseNode {
1996
+ +operator: string;
1997
+ +prefix: boolean;
1998
+ +argument: LeftHandSideExpression | Literal | UnaryExpression;
1999
+ }
2000
+ export interface UpdateExpression extends UnaryExpressionBase {
2001
+ +type: 'UpdateExpression';
2002
+ +operator: '--' | '++';
2003
+ }
2004
+ export interface VariableDeclaration extends BaseNode {
2005
+ +type: 'VariableDeclaration';
2006
+ /**
2007
+ * The variables declared by this declaration.
2008
+ * Note that there may be 0 declarations (i.e. `const;`).
2009
+ * ```
2010
+ * let x;
2011
+ * let y, z;
2012
+ * ```
2013
+ */
2014
+ +declarations: $ReadOnlyArray<VariableDeclarator>;
2015
+ /**
2016
+ * Whether the declaration is `declare`d
2017
+ * ```
2018
+ * declare const x = 1;
2019
+ * ```
2020
+ */
2021
+ +declare?: boolean;
2022
+ /**
2023
+ * The keyword used to declare the variable(s)
2024
+ * ```
2025
+ * const x = 1;
2026
+ * let y = 2;
2027
+ * var z = 3;
2028
+ * ```
2029
+ */
2030
+ +kind: 'const' | 'let' | 'var';
2031
+ }
2032
+ export interface VariableDeclarator extends BaseNode {
2033
+ +type: 'VariableDeclarator';
2034
+ +id: BindingName;
2035
+ +init: Expression | null;
2036
+ +definite?: boolean;
2037
+ }
2038
+ export interface WhileStatement extends BaseNode {
2039
+ +type: 'WhileStatement';
2040
+ +test: Expression;
2041
+ +body: Statement;
2042
+ }
2043
+ export interface WithStatement extends BaseNode {
2044
+ +type: 'WithStatement';
2045
+ +object: Expression;
2046
+ +body: Statement;
2047
+ }
2048
+ export interface YieldExpression extends BaseNode {
2049
+ +type: 'YieldExpression';
2050
+ +delegate: boolean;
2051
+ +argument?: Expression;
2052
+ }