clawbot-estree 0.25.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1998 @@
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
8
+ * @format
9
+ */
10
+
11
+ 'use strict';
12
+
13
+ /**
14
+ *
15
+ * IMPORTANT NOTE
16
+ *
17
+ * This file intentionally uses interfaces and `+` for readonly.
18
+ *
19
+ * - `$ReadOnly` is an "evaluated" utility type in flow; meaning that flow does
20
+ * not actually calculate the resulting type until it is used. This creates
21
+ * a copy of the type at each usage site - ballooning memory and processing
22
+ * times.
23
+ * Usually this isn't a problem as a type might only be used one or two times
24
+ * - but in this giant circular-referencing graph that is the AST types, this
25
+ * causes check times for consumers to be awful.
26
+ *
27
+ * Thus instead we manually annotate properties with `+` to avoid the `$ReadOnly` type.
28
+ *
29
+ * - `...Type` spreads do not preserve the readonly-ness of the properties. If
30
+ * we used object literal types then we would have to `$ReadOnly` all spreads
31
+ * (see point 1). On the other hand extending an interface does preserve
32
+ * readonlyness of properties.
33
+ *
34
+ * Thus instead of object literals, we use interfaces.
35
+ *
36
+ *** Please ensure all properties are marked as readonly! ***
37
+ */
38
+
39
+ export type Range = [number, number];
40
+
41
+ export interface ObjectWithLoc {
42
+ +loc: SourceLocation;
43
+ }
44
+ export interface BaseToken extends ObjectWithLoc {
45
+ +loc: SourceLocation;
46
+ +range: Range;
47
+ }
48
+ export interface BaseNode extends BaseToken {
49
+ // this is added by ESLint and is not part of the ESTree spec
50
+ +parent: ESNode;
51
+ }
52
+
53
+ /*
54
+ * Token and Comment are pseudo-nodes to represent pieces of source code
55
+ *
56
+ * NOTE:
57
+ * They are not included in the `ESNode` union below on purpose because they
58
+ * are not ever included as part of the standard AST tree.
59
+ */
60
+
61
+ export interface MostTokens extends BaseToken {
62
+ +type:
63
+ | 'Boolean'
64
+ | 'Identifier'
65
+ | 'JSXIdentifier'
66
+ | 'JSXText'
67
+ | 'Keyword'
68
+ | 'Null'
69
+ | 'Numeric'
70
+ | 'BigInt'
71
+ | 'Punctuator'
72
+ | 'RegularExpression'
73
+ | 'String'
74
+ | 'Template'
75
+ // comment types
76
+ | 'Block'
77
+ | 'Line';
78
+ +value: string;
79
+ }
80
+ export interface RegexToken extends BaseToken {
81
+ +type: 'RegularExpression';
82
+ +value: string;
83
+ +regex: {
84
+ +pattern: string,
85
+ +flags: string,
86
+ };
87
+ }
88
+ export interface LineComment extends BaseToken {
89
+ +type: 'Line';
90
+ +value: string;
91
+ }
92
+ export interface BlockComment extends BaseToken {
93
+ +type: 'Block';
94
+ +value: string;
95
+ }
96
+ export type Comment = LineComment | BlockComment;
97
+ export type Token = MostTokens | RegexToken | Comment;
98
+
99
+ export interface SourceLocation {
100
+ +start: Position;
101
+ +end: Position;
102
+ }
103
+
104
+ export interface Position {
105
+ /** >= 1 */
106
+ +line: number;
107
+ /** >= 0 */
108
+ +column: number;
109
+ }
110
+
111
+ // note: this is only ever present on Program.interpreter, never in the body
112
+ export interface InterpreterDirective extends BaseNode {
113
+ type: 'InterpreterDirective';
114
+ value: string;
115
+ }
116
+
117
+ export type DocblockDirectives = $ReadOnly<{
118
+ // some well-known tags
119
+ flow?: $ReadOnlyArray<string> | void,
120
+ format?: $ReadOnlyArray<string> | void,
121
+ noflow?: $ReadOnlyArray<string> | void,
122
+ noformat?: $ReadOnlyArray<string> | void,
123
+ [string]: $ReadOnlyArray<string> | void,
124
+ }>;
125
+
126
+ export type DocblockMetadata = $ReadOnly<{
127
+ directives: DocblockDirectives,
128
+ comment: BlockComment,
129
+ }>;
130
+
131
+ export interface Program extends BaseNode {
132
+ +type: 'Program';
133
+ +sourceType: 'script' | 'module';
134
+ +body: $ReadOnlyArray<Statement | ModuleDeclaration>;
135
+ +tokens: $ReadOnlyArray<Token>;
136
+ +comments: $ReadOnlyArray<Comment>;
137
+ +loc: SourceLocation;
138
+ +interpreter: null | InterpreterDirective;
139
+ +docblock: null | DocblockMetadata;
140
+ // program is the only node without a parent - but typing it as such is _super_ annoying and difficult
141
+ +parent: ESNode;
142
+ }
143
+
144
+ // Flow declares a "Node" type as part of its HTML typedefs.
145
+ // Because this file declares global types - we can't clash with it
146
+ export type ESNode =
147
+ | Identifier
148
+ | PrivateIdentifier
149
+ | Literal
150
+ | Program
151
+ | AFunction
152
+ | SwitchCase
153
+ | CatchClause
154
+ | VariableDeclarator
155
+ | Statement
156
+ | Expression
157
+ | Property
158
+ | Super
159
+ | TemplateElement
160
+ | SpreadElement
161
+ | BindingName
162
+ | RestElement
163
+ | AssignmentPattern
164
+ | MemberExpression
165
+ | ClassBody
166
+ | AClass
167
+ | MethodDefinition
168
+ | PropertyDefinition
169
+ | ModuleDeclaration
170
+ | ModuleSpecifier
171
+ | ImportAttribute
172
+ // flow nodes
173
+ | TypeAnnotation
174
+ | TypeAnnotationType
175
+ | Variance
176
+ | FunctionTypeParam
177
+ | ComponentTypeParameter
178
+ | InferredPredicate
179
+ | ObjectTypeProperty
180
+ | ObjectTypeCallProperty
181
+ | ObjectTypeIndexer
182
+ | ObjectTypeSpreadProperty
183
+ | ObjectTypeMappedTypeProperty
184
+ | InterfaceExtends
185
+ | ClassImplements
186
+ | Decorator
187
+ | TypeParameterDeclaration
188
+ | TypeParameter
189
+ | TypeParameterInstantiation
190
+ | ComponentDeclaration
191
+ | ComponentParameter
192
+ | HookDeclaration
193
+ | EnumDeclaration
194
+ | EnumNumberBody
195
+ | EnumBigIntBody
196
+ | EnumStringBody
197
+ | EnumStringMember
198
+ | EnumDefaultedMember
199
+ | EnumNumberMember
200
+ | EnumBigIntMember
201
+ | EnumBooleanBody
202
+ | EnumBooleanMember
203
+ | EnumSymbolBody
204
+ | DeclaredNode
205
+ | ObjectTypeInternalSlot
206
+ // JSX
207
+ | JSXNode;
208
+
209
+ export type BindingName = Identifier | BindingPattern;
210
+ export type BindingPattern = ArrayPattern | ObjectPattern;
211
+ export type RestElementPattern = AssignmentPattern | BindingName | RestElement;
212
+ export type FunctionParameter = AssignmentPattern | BindingName | RestElement;
213
+ export type DestructuringPattern =
214
+ | BindingName
215
+ | AssignmentPattern
216
+ | MemberExpression
217
+ | RestElement;
218
+
219
+ interface BaseFunction extends BaseNode {
220
+ +params: $ReadOnlyArray<FunctionParameter>;
221
+ +async: boolean;
222
+
223
+ +predicate: null | InferredPredicate;
224
+ +returnType: null | TypeAnnotation;
225
+ +typeParameters: null | TypeParameterDeclaration;
226
+ }
227
+
228
+ export type AFunction =
229
+ | FunctionDeclaration
230
+ | FunctionExpression
231
+ | ArrowFunctionExpression;
232
+
233
+ export type Statement =
234
+ | BlockStatement
235
+ | BreakStatement
236
+ | ClassDeclaration
237
+ | ComponentDeclaration
238
+ | ContinueStatement
239
+ | DebuggerStatement
240
+ | DeclareClass
241
+ | DeclareComponent
242
+ | DeclareHook
243
+ | DeclareVariable
244
+ | DeclareEnum
245
+ | DeclareFunction
246
+ | DeclareInterface
247
+ | DeclareModule
248
+ | DeclareNamespace
249
+ | DeclareOpaqueType
250
+ | DeclareTypeAlias
251
+ | DoWhileStatement
252
+ | EmptyStatement
253
+ | EnumDeclaration
254
+ | ExpressionStatement
255
+ | ForInStatement
256
+ | ForOfStatement
257
+ | ForStatement
258
+ | FunctionDeclaration
259
+ | HookDeclaration
260
+ | IfStatement
261
+ | InterfaceDeclaration
262
+ | LabeledStatement
263
+ | OpaqueType
264
+ | ReturnStatement
265
+ | SwitchStatement
266
+ | ThrowStatement
267
+ | TryStatement
268
+ | TypeAlias
269
+ | VariableDeclaration
270
+ | WhileStatement
271
+ | WithStatement;
272
+
273
+ // nodes that can be the direct parent of a statement
274
+ export type StatementParentSingle =
275
+ | IfStatement
276
+ | LabeledStatement
277
+ | WithStatement
278
+ | WhileStatement
279
+ | DoWhileStatement
280
+ | ForStatement
281
+ | ForInStatement
282
+ | ForOfStatement;
283
+ // nodes that can be the parent of a statement that store the statements in an array
284
+ export type StatementParentArray = SwitchCase | Program | BlockStatement;
285
+ export type StatementParent = StatementParentSingle | StatementParentArray;
286
+
287
+ export interface EmptyStatement extends BaseNode {
288
+ +type: 'EmptyStatement';
289
+ }
290
+
291
+ export interface BlockStatement extends BaseNode {
292
+ +type: 'BlockStatement';
293
+ +body: $ReadOnlyArray<Statement>;
294
+ }
295
+
296
+ export interface ExpressionStatement extends BaseNode {
297
+ +type: 'ExpressionStatement';
298
+ +expression: Expression;
299
+ +directive: string | null;
300
+ }
301
+
302
+ export interface IfStatement extends BaseNode {
303
+ +type: 'IfStatement';
304
+ +test: Expression;
305
+ +consequent: Statement;
306
+ +alternate?: Statement | null;
307
+ }
308
+
309
+ export interface LabeledStatement extends BaseNode {
310
+ +type: 'LabeledStatement';
311
+ +label: Identifier;
312
+ +body: Statement;
313
+ }
314
+
315
+ export interface BreakStatement extends BaseNode {
316
+ +type: 'BreakStatement';
317
+ +label?: Identifier | null;
318
+ }
319
+
320
+ export interface ContinueStatement extends BaseNode {
321
+ +type: 'ContinueStatement';
322
+ +label?: Identifier | null;
323
+ }
324
+
325
+ export interface WithStatement extends BaseNode {
326
+ +type: 'WithStatement';
327
+ +object: Expression;
328
+ +body: Statement;
329
+ }
330
+
331
+ export interface SwitchStatement extends BaseNode {
332
+ +type: 'SwitchStatement';
333
+ +discriminant: Expression;
334
+ +cases: $ReadOnlyArray<SwitchCase>;
335
+ }
336
+
337
+ export interface ReturnStatement extends BaseNode {
338
+ +type: 'ReturnStatement';
339
+ +argument?: Expression | null;
340
+ }
341
+
342
+ export interface ThrowStatement extends BaseNode {
343
+ +type: 'ThrowStatement';
344
+ +argument: Expression;
345
+ }
346
+
347
+ export interface TryStatement extends BaseNode {
348
+ +type: 'TryStatement';
349
+ +block: BlockStatement;
350
+ +handler?: CatchClause | null;
351
+ +finalizer?: BlockStatement | null;
352
+ }
353
+
354
+ export interface WhileStatement extends BaseNode {
355
+ +type: 'WhileStatement';
356
+ +test: Expression;
357
+ +body: Statement;
358
+ }
359
+
360
+ export interface DoWhileStatement extends BaseNode {
361
+ +type: 'DoWhileStatement';
362
+ +body: Statement;
363
+ +test: Expression;
364
+ }
365
+
366
+ export interface ForStatement extends BaseNode {
367
+ +type: 'ForStatement';
368
+ +init?: VariableDeclaration | Expression | null;
369
+ +test?: Expression | null;
370
+ +update?: Expression | null;
371
+ +body: Statement;
372
+ }
373
+
374
+ interface BaseForXStatement extends BaseNode {
375
+ +left: VariableDeclaration | BindingName | MemberExpression;
376
+ +right: Expression;
377
+ +body: Statement;
378
+ }
379
+
380
+ export interface ForInStatement extends BaseForXStatement {
381
+ +type: 'ForInStatement';
382
+ }
383
+
384
+ export interface ForOfStatement extends BaseForXStatement {
385
+ +type: 'ForOfStatement';
386
+ +await: boolean;
387
+ }
388
+
389
+ export interface DebuggerStatement extends BaseNode {
390
+ +type: 'DebuggerStatement';
391
+ }
392
+
393
+ type ComponentParameterAndRestElement = ComponentParameter | RestElement;
394
+
395
+ export interface ComponentParameter extends BaseNode {
396
+ +type: 'ComponentParameter';
397
+ +name: Identifier | StringLiteral;
398
+ +local: BindingName | AssignmentPattern;
399
+ +shorthand: boolean;
400
+ }
401
+
402
+ export interface ComponentDeclaration extends BaseNode {
403
+ +type: 'ComponentDeclaration';
404
+ +body: BlockStatement;
405
+ +id: Identifier;
406
+ +params: $ReadOnlyArray<ComponentParameterAndRestElement>;
407
+ +rendersType: null | RendersType;
408
+ +typeParameters: null | TypeParameterDeclaration;
409
+ }
410
+
411
+ export interface HookDeclaration extends BaseNode {
412
+ +type: 'HookDeclaration';
413
+ +id: Identifier;
414
+ +body: BlockStatement;
415
+ +params: $ReadOnlyArray<FunctionParameter>;
416
+ +returnType: null | TypeAnnotation;
417
+ +typeParameters: null | TypeParameterDeclaration;
418
+ }
419
+
420
+ export interface FunctionDeclaration extends BaseFunction {
421
+ +type: 'FunctionDeclaration';
422
+ /** It is null when a function declaration is a part of the `export default function` statement */
423
+ +id: Identifier | null;
424
+ +body: BlockStatement;
425
+ +generator: boolean;
426
+ }
427
+
428
+ export interface VariableDeclaration extends BaseNode {
429
+ +type: 'VariableDeclaration';
430
+ +declarations: $ReadOnlyArray<VariableDeclarator>;
431
+ +kind: 'var' | 'let' | 'const';
432
+ }
433
+
434
+ export interface VariableDeclarator extends BaseNode {
435
+ +type: 'VariableDeclarator';
436
+ +id: BindingName;
437
+ +init?: Expression | null;
438
+
439
+ +parent: VariableDeclaration;
440
+ }
441
+
442
+ export type Expression =
443
+ | ThisExpression
444
+ | ArrayExpression
445
+ | ObjectExpression
446
+ | FunctionExpression
447
+ | ArrowFunctionExpression
448
+ | YieldExpression
449
+ | Literal
450
+ | UnaryExpression
451
+ | UpdateExpression
452
+ | BinaryExpression
453
+ | AssignmentExpression
454
+ | LogicalExpression
455
+ | MemberExpression
456
+ | ConditionalExpression
457
+ | CallExpression
458
+ | NewExpression
459
+ | SequenceExpression
460
+ | TemplateLiteral
461
+ | TaggedTemplateExpression
462
+ | ClassExpression
463
+ | MetaProperty
464
+ | Identifier
465
+ | AwaitExpression
466
+ | ImportExpression
467
+ | ChainExpression
468
+ | TypeCastExpression
469
+ | AsExpression
470
+ | AsConstExpression
471
+ | JSXFragment
472
+ | JSXElement;
473
+
474
+ export interface ThisExpression extends BaseNode {
475
+ +type: 'ThisExpression';
476
+ }
477
+
478
+ export interface ArrayExpression extends BaseNode {
479
+ +type: 'ArrayExpression';
480
+ +elements: $ReadOnlyArray<Expression | SpreadElement>;
481
+ // this is not part of the ESTree spec, but clawbot emits it
482
+ +trailingComma: boolean;
483
+ }
484
+
485
+ export interface ObjectExpression extends BaseNode {
486
+ +type: 'ObjectExpression';
487
+ +properties: $ReadOnlyArray<ObjectProperty | SpreadElement>;
488
+ }
489
+
490
+ // This is the complete type of a "Property"
491
+ // This same node (unfortunately) covers both object literal properties
492
+ // and object desturcturing properties.
493
+ export type Property = ObjectProperty | DestructuringObjectProperty;
494
+
495
+ export type ObjectProperty =
496
+ | ObjectPropertyWithNonShorthandStaticName
497
+ | ObjectPropertyWithShorthandStaticName
498
+ | ObjectPropertyWithComputedName;
499
+ interface ObjectPropertyBase extends BaseNode {
500
+ +parent: ObjectExpression | ObjectPattern;
501
+ }
502
+ export interface ObjectPropertyWithNonShorthandStaticName
503
+ extends ObjectPropertyBase {
504
+ +type: 'Property';
505
+ +computed: false;
506
+ // non-computed, non-shorthand names are constrained significantly
507
+ +key: Identifier | StringLiteral | NumericLiteral;
508
+ +value: Expression;
509
+ +kind: 'init' | 'get' | 'set';
510
+ +method: boolean;
511
+ +shorthand: false;
512
+ }
513
+ export interface ObjectPropertyWithShorthandStaticName
514
+ extends ObjectPropertyBase {
515
+ +type: 'Property';
516
+ +computed: false;
517
+ // shorthand keys *must* be identifiers
518
+ +key: Identifier;
519
+ // shorthand values *must* be identifiers (that look the same as the key)
520
+ +value: Identifier;
521
+ +kind: 'init';
522
+ +method: false;
523
+ +shorthand: true;
524
+ }
525
+ export interface ObjectPropertyWithComputedName extends ObjectPropertyBase {
526
+ +type: 'Property';
527
+ +computed: true;
528
+ // computed names can be any expression
529
+ +key: Expression;
530
+ +value: Expression;
531
+ +kind: 'init' | 'get' | 'set';
532
+ +method: boolean;
533
+ // cannot have a shorthand computed name
534
+ +shorthand: false;
535
+ }
536
+
537
+ export type DestructuringObjectProperty =
538
+ | DestructuringObjectPropertyWithNonShorthandStaticName
539
+ | DestructuringObjectPropertyWithShorthandStaticName
540
+ | DestructuringObjectPropertyWithComputedName;
541
+ interface DestructuringObjectPropertyBase extends BaseNode {
542
+ // destructuring properties cannot be methods
543
+ +kind: 'init';
544
+ +method: false;
545
+
546
+ +parent: ObjectExpression | ObjectPattern;
547
+ }
548
+ export interface DestructuringObjectPropertyWithNonShorthandStaticName
549
+ extends DestructuringObjectPropertyBase {
550
+ +type: 'Property';
551
+ +computed: false;
552
+ // non-computed, non-shorthand names are constrained significantly
553
+ +key: Identifier | StringLiteral | NumericLiteral;
554
+ // destructuring properties cannot have any value
555
+ +value: DestructuringPattern;
556
+ +shorthand: false;
557
+ }
558
+ export interface DestructuringObjectPropertyWithShorthandStaticName
559
+ extends DestructuringObjectPropertyBase {
560
+ +type: 'Property';
561
+ +computed: false;
562
+ // shorthand keys *must* be identifiers
563
+ +key: Identifier;
564
+ // shorthand values *must* be identifiers or assignments (that look the same as the key)
565
+ +value: Identifier | AssignmentPattern;
566
+ +shorthand: true;
567
+ }
568
+ export interface DestructuringObjectPropertyWithComputedName
569
+ extends DestructuringObjectPropertyBase {
570
+ +type: 'Property';
571
+ +computed: true;
572
+ // computed names can be any expression
573
+ +key: Expression;
574
+ // destructuring properties cannot have any value
575
+ +value: DestructuringPattern;
576
+ // cannot have a shorthand computed name
577
+ +shorthand: false;
578
+ }
579
+
580
+ export interface FunctionExpression extends BaseFunction {
581
+ +id?: Identifier | null;
582
+ +type: 'FunctionExpression';
583
+ +body: BlockStatement;
584
+ +generator: boolean;
585
+ }
586
+
587
+ export interface SequenceExpression extends BaseNode {
588
+ +type: 'SequenceExpression';
589
+ +expressions: $ReadOnlyArray<Expression>;
590
+ }
591
+
592
+ export interface UnaryExpression extends BaseNode {
593
+ +type: 'UnaryExpression';
594
+ +operator: UnaryOperator;
595
+ +prefix: true;
596
+ +argument: Expression;
597
+ }
598
+
599
+ export interface BinaryExpressionWithoutIn extends BaseNode {
600
+ +type: 'BinaryExpression';
601
+ +operator: BinaryOperatorWithoutIn;
602
+ +left: Expression;
603
+ +right: Expression;
604
+ }
605
+
606
+ // Private brand checks (#foo in bar) are a special case
607
+ // other binary expressions do not allow PrivateIdentifier in the left
608
+ export interface BinaryExpressionIn extends BaseNode {
609
+ +type: 'BinaryExpression';
610
+ +operator: 'in';
611
+ +left: Expression | PrivateIdentifier;
612
+ +right: Expression;
613
+ }
614
+
615
+ export type BinaryExpression = BinaryExpressionWithoutIn | BinaryExpressionIn;
616
+
617
+ export interface AssignmentExpression extends BaseNode {
618
+ +type: 'AssignmentExpression';
619
+ +operator: AssignmentOperator;
620
+ +left: BindingName | MemberExpression;
621
+ +right: Expression;
622
+ }
623
+
624
+ export interface UpdateExpression extends BaseNode {
625
+ +type: 'UpdateExpression';
626
+ +operator: UpdateOperator;
627
+ +argument: Expression;
628
+ +prefix: boolean;
629
+ }
630
+
631
+ export interface LogicalExpression extends BaseNode {
632
+ +type: 'LogicalExpression';
633
+ +operator: LogicalOperator;
634
+ +left: Expression;
635
+ +right: Expression;
636
+ }
637
+
638
+ export interface ConditionalExpression extends BaseNode {
639
+ +type: 'ConditionalExpression';
640
+ +test: Expression;
641
+ +alternate: Expression;
642
+ +consequent: Expression;
643
+ }
644
+
645
+ interface BaseCallExpression extends BaseNode {
646
+ +callee: Expression | Super;
647
+ +arguments: $ReadOnlyArray<Expression | SpreadElement>;
648
+ +typeArguments: null | TypeParameterInstantiation;
649
+ }
650
+ export interface CallExpression extends BaseCallExpression {
651
+ +type: 'CallExpression';
652
+ +optional: boolean;
653
+ }
654
+
655
+ export interface NewExpression extends BaseCallExpression {
656
+ +type: 'NewExpression';
657
+ }
658
+
659
+ export type MemberExpression =
660
+ | MemberExpressionWithComputedName
661
+ | MemberExpressionWithNonComputedName;
662
+ export interface MemberExpressionWithComputedName extends BaseNode {
663
+ +type: 'MemberExpression';
664
+ +object: Expression | Super;
665
+ +property: Expression;
666
+ +computed: true;
667
+ +optional: boolean;
668
+ }
669
+ export interface MemberExpressionWithNonComputedName extends BaseNode {
670
+ +type: 'MemberExpression';
671
+ +object: Expression | Super;
672
+ +property: Identifier | PrivateIdentifier;
673
+ +computed: false;
674
+ +optional: boolean;
675
+ }
676
+
677
+ export type ChainElement = CallExpression | MemberExpression;
678
+
679
+ export interface ChainExpression extends BaseNode {
680
+ +type: 'ChainExpression';
681
+ +expression: ChainElement;
682
+ }
683
+
684
+ export interface SwitchCase extends BaseNode {
685
+ +type: 'SwitchCase';
686
+ +test?: Expression | null;
687
+ +consequent: $ReadOnlyArray<Statement>;
688
+ }
689
+
690
+ export interface CatchClause extends BaseNode {
691
+ +type: 'CatchClause';
692
+ +param: BindingName | null;
693
+ +body: BlockStatement;
694
+ }
695
+
696
+ export interface Identifier extends BaseNode {
697
+ +type: 'Identifier';
698
+ +name: string;
699
+
700
+ +typeAnnotation: TypeAnnotation | null;
701
+ // only applies to function arguments
702
+ +optional: boolean;
703
+ }
704
+
705
+ export interface PrivateIdentifier extends BaseNode {
706
+ +type: 'PrivateIdentifier';
707
+ +name: string;
708
+ }
709
+
710
+ export type Literal =
711
+ | BigIntLiteral
712
+ | BooleanLiteral
713
+ | NullLiteral
714
+ | NumericLiteral
715
+ | RegExpLiteral
716
+ | StringLiteral;
717
+
718
+ export interface BigIntLiteral extends BaseNode {
719
+ +type: 'Literal';
720
+ +value: bigint;
721
+ +bigint: string;
722
+ +raw: string;
723
+ +literalType: 'bigint';
724
+ }
725
+
726
+ export interface BooleanLiteral extends BaseNode {
727
+ +type: 'Literal';
728
+ +value: boolean;
729
+ +raw: 'true' | 'false';
730
+ +literalType: 'boolean';
731
+ }
732
+
733
+ export interface NullLiteral extends BaseNode {
734
+ +type: 'Literal';
735
+ +value: null;
736
+ +raw: 'null';
737
+ +literalType: 'null';
738
+ }
739
+
740
+ export interface NumericLiteral extends BaseNode {
741
+ +type: 'Literal';
742
+ +value: number;
743
+ +raw: string;
744
+ +literalType: 'numeric';
745
+ }
746
+
747
+ export interface RegExpLiteral extends BaseNode {
748
+ +type: 'Literal';
749
+ +value: RegExp | null;
750
+ +regex: interface {
751
+ +pattern: string,
752
+ +flags: string,
753
+ };
754
+ +raw: string;
755
+ +literalType: 'regexp';
756
+ }
757
+
758
+ export interface StringLiteral extends BaseNode {
759
+ +type: 'Literal';
760
+ +value: string;
761
+ +raw: string;
762
+ +literalType: 'string';
763
+ }
764
+
765
+ export type UnaryOperator =
766
+ | '-'
767
+ | '+'
768
+ | '!'
769
+ | '~'
770
+ | 'typeof'
771
+ | 'void'
772
+ | 'delete';
773
+
774
+ export type BinaryOperatorWithoutIn =
775
+ | '=='
776
+ | '!='
777
+ | '==='
778
+ | '!=='
779
+ | '<'
780
+ | '<='
781
+ | '>'
782
+ | '>='
783
+ | '<<'
784
+ | '>>'
785
+ | '>>>'
786
+ | '+'
787
+ | '-'
788
+ | '*'
789
+ | '/'
790
+ | '%'
791
+ | '**'
792
+ | '|'
793
+ | '^'
794
+ | '&'
795
+ | 'instanceof';
796
+
797
+ export type BinaryOperator = BinaryOperatorWithoutIn | 'in';
798
+
799
+ export type LogicalOperator = '||' | '&&' | '??';
800
+
801
+ export type AssignmentOperator =
802
+ | '='
803
+ | '+='
804
+ | '-='
805
+ | '*='
806
+ | '/='
807
+ | '%='
808
+ | '**='
809
+ | '<<='
810
+ | '>>='
811
+ | '>>>='
812
+ | '|='
813
+ | '^='
814
+ | '&='
815
+ // not yet supported, but future proofing
816
+ | '||='
817
+ | '&&='
818
+ | '??=';
819
+
820
+ export type UpdateOperator = '++' | '--';
821
+
822
+ export interface Super extends BaseNode {
823
+ +type: 'Super';
824
+ }
825
+
826
+ export interface SpreadElement extends BaseNode {
827
+ +type: 'SpreadElement';
828
+ +argument: Expression;
829
+ }
830
+
831
+ export interface ArrowFunctionExpression extends BaseFunction {
832
+ +type: 'ArrowFunctionExpression';
833
+ +expression: boolean;
834
+ +body: BlockStatement | Expression;
835
+ // clawbot emits this - but it's always null
836
+ +id: null;
837
+ // note - arrow functions cannot be generators
838
+ }
839
+
840
+ export interface YieldExpression extends BaseNode {
841
+ +type: 'YieldExpression';
842
+ +argument?: Expression | null;
843
+ +delegate: boolean;
844
+ }
845
+
846
+ export interface TemplateLiteral extends BaseNode {
847
+ +type: 'TemplateLiteral';
848
+ +quasis: $ReadOnlyArray<TemplateElement>;
849
+ +expressions: $ReadOnlyArray<Expression>;
850
+ }
851
+
852
+ export interface TaggedTemplateExpression extends BaseNode {
853
+ +type: 'TaggedTemplateExpression';
854
+ +tag: Expression;
855
+ +quasi: TemplateLiteral;
856
+ }
857
+
858
+ export interface TemplateElement extends BaseNode {
859
+ +type: 'TemplateElement';
860
+ +tail: boolean;
861
+ +value: interface {
862
+ +cooked: string,
863
+ +raw: string,
864
+ };
865
+ }
866
+
867
+ export interface ObjectPattern extends BaseNode {
868
+ +type: 'ObjectPattern';
869
+ +properties: $ReadOnlyArray<DestructuringObjectProperty | RestElement>;
870
+ // if used as a VariableDeclarator.id
871
+ +typeAnnotation: TypeAnnotation | null;
872
+ }
873
+
874
+ export interface ArrayPattern extends BaseNode {
875
+ +type: 'ArrayPattern';
876
+ // an element will be null if the pattern contains a hole: `[a,,b]`
877
+ +elements: $ReadOnlyArray<?DestructuringPattern>;
878
+ +typeAnnotation: TypeAnnotation | null;
879
+ }
880
+
881
+ export interface RestElement extends BaseNode {
882
+ +type: 'RestElement';
883
+ +argument: RestElementPattern;
884
+ // the Pattern owns the typeAnnotation
885
+ }
886
+
887
+ export interface AssignmentPattern extends BaseNode {
888
+ +type: 'AssignmentPattern';
889
+ +left: BindingName;
890
+ +right: Expression;
891
+ }
892
+
893
+ export type AClass = ClassDeclaration | ClassExpression;
894
+ interface BaseClass extends BaseNode {
895
+ +superClass?: Expression | null;
896
+ +body: ClassBody;
897
+
898
+ +typeParameters: null | TypeParameterDeclaration;
899
+ +superTypeParameters: null | TypeParameterInstantiation;
900
+ +implements: $ReadOnlyArray<ClassImplements>;
901
+ +decorators: $ReadOnlyArray<Decorator>;
902
+ }
903
+
904
+ export type PropertyName =
905
+ | ClassPropertyNameComputed
906
+ | ClassPropertyNameNonComputed;
907
+ export type ClassPropertyNameComputed = Expression;
908
+ export type ClassPropertyNameNonComputed =
909
+ | PrivateIdentifier
910
+ | Identifier
911
+ | StringLiteral;
912
+
913
+ export type ClassMember = PropertyDefinition | MethodDefinition;
914
+ export type ClassMemberWithNonComputedName =
915
+ | PropertyDefinitionWithNonComputedName
916
+ | MethodDefinitionConstructor
917
+ | MethodDefinitionWithNonComputedName;
918
+ export interface ClassBody extends BaseNode {
919
+ +type: 'ClassBody';
920
+ +body: $ReadOnlyArray<ClassMember>;
921
+
922
+ +parent: AClass;
923
+ }
924
+
925
+ export type MethodDefinition =
926
+ | MethodDefinitionConstructor
927
+ | MethodDefinitionWithComputedName
928
+ | MethodDefinitionWithNonComputedName;
929
+ interface MethodDefinitionBase extends BaseNode {
930
+ +value: FunctionExpression;
931
+
932
+ +parent: ClassBody;
933
+ }
934
+ export interface MethodDefinitionConstructor extends MethodDefinitionBase {
935
+ +type: 'MethodDefinition';
936
+ +key: Identifier | StringLiteral;
937
+ +kind: 'constructor';
938
+ +computed: false;
939
+ +static: false;
940
+ }
941
+ export interface MethodDefinitionWithComputedName extends MethodDefinitionBase {
942
+ +type: 'MethodDefinition';
943
+ +key: ClassPropertyNameComputed;
944
+ +kind: 'method' | 'get' | 'set';
945
+ +computed: true;
946
+ +static: boolean;
947
+ }
948
+ export interface MethodDefinitionWithNonComputedName
949
+ extends MethodDefinitionBase {
950
+ +type: 'MethodDefinition';
951
+ +key: ClassPropertyNameNonComputed;
952
+ +kind: 'method' | 'get' | 'set';
953
+ +computed: false;
954
+ +static: boolean;
955
+ }
956
+
957
+ // `PropertyDefinition` is the new standard for all class properties
958
+ export type PropertyDefinition =
959
+ | PropertyDefinitionWithComputedName
960
+ | PropertyDefinitionWithNonComputedName;
961
+ interface PropertyDefinitionBase extends BaseNode {
962
+ +value: null | Expression;
963
+ +typeAnnotation: null | TypeAnnotation;
964
+ +static: boolean;
965
+ +variance: null | Variance;
966
+ +declare: boolean;
967
+ // clawbot always emit this as false
968
+ +optional: false;
969
+
970
+ +parent: ClassBody;
971
+ }
972
+ export interface PropertyDefinitionWithComputedName
973
+ extends PropertyDefinitionBase {
974
+ +type: 'PropertyDefinition';
975
+ +key: ClassPropertyNameComputed;
976
+ +computed: true;
977
+ }
978
+ export interface PropertyDefinitionWithNonComputedName
979
+ extends PropertyDefinitionBase {
980
+ +type: 'PropertyDefinition';
981
+ +key: ClassPropertyNameNonComputed;
982
+ +computed: false;
983
+ }
984
+
985
+ export interface ClassDeclaration extends BaseClass {
986
+ +type: 'ClassDeclaration';
987
+ /** It is null when a class declaration is a part of the `export default class` statement */
988
+ +id: Identifier | null;
989
+ }
990
+
991
+ export interface ClassExpression extends BaseClass {
992
+ +type: 'ClassExpression';
993
+ +id?: Identifier | null;
994
+ }
995
+
996
+ export interface MetaProperty extends BaseNode {
997
+ +type: 'MetaProperty';
998
+ +meta: Identifier;
999
+ +property: Identifier;
1000
+ }
1001
+
1002
+ export type ModuleDeclaration =
1003
+ | ImportDeclaration
1004
+ | ExportNamedDeclaration
1005
+ | ExportDefaultDeclaration
1006
+ | ExportAllDeclaration
1007
+ | DeclareExportDeclaration
1008
+ | DeclareExportAllDeclaration
1009
+ | DeclareModuleExports;
1010
+
1011
+ export type ModuleSpecifier =
1012
+ | ImportSpecifier
1013
+ | ImportDefaultSpecifier
1014
+ | ImportNamespaceSpecifier
1015
+ | ExportSpecifier;
1016
+
1017
+ export interface ImportDeclaration extends BaseNode {
1018
+ +type: 'ImportDeclaration';
1019
+ +specifiers: $ReadOnlyArray<
1020
+ ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier,
1021
+ >;
1022
+ +source: StringLiteral;
1023
+ +assertions: $ReadOnlyArray<ImportAttribute>;
1024
+
1025
+ +importKind: 'value' | 'type' | 'typeof';
1026
+ }
1027
+ export interface ImportAttribute extends BaseNode {
1028
+ +type: 'ImportAttribute';
1029
+ +key: Identifier;
1030
+ +value: StringLiteral;
1031
+
1032
+ +parent: ImportDeclaration | ImportExpression;
1033
+ }
1034
+
1035
+ export interface ImportSpecifier extends BaseNode {
1036
+ +type: 'ImportSpecifier';
1037
+ +imported: Identifier;
1038
+ +local: Identifier;
1039
+ +importKind: null | 'type' | 'typeof';
1040
+
1041
+ +parent: ImportDeclaration;
1042
+ }
1043
+
1044
+ export interface ImportExpression extends BaseNode {
1045
+ +type: 'ImportExpression';
1046
+ +source: Expression;
1047
+ +attributes: $ReadOnlyArray<ImportAttribute> | null;
1048
+ }
1049
+
1050
+ export interface ImportDefaultSpecifier extends BaseNode {
1051
+ +type: 'ImportDefaultSpecifier';
1052
+ +local: Identifier;
1053
+
1054
+ +parent: ImportDeclaration;
1055
+ }
1056
+
1057
+ export interface ImportNamespaceSpecifier extends BaseNode {
1058
+ +type: 'ImportNamespaceSpecifier';
1059
+ +local: Identifier;
1060
+
1061
+ +parent: ImportDeclaration;
1062
+ }
1063
+
1064
+ export type DefaultDeclaration =
1065
+ | FunctionDeclaration
1066
+ | ClassDeclaration
1067
+ | ComponentDeclaration
1068
+ | HookDeclaration;
1069
+ export type NamedDeclaration =
1070
+ | DefaultDeclaration
1071
+ | VariableDeclaration
1072
+ | TypeAlias
1073
+ | OpaqueType
1074
+ | InterfaceDeclaration
1075
+ | EnumDeclaration;
1076
+
1077
+ interface ExportNamedDeclarationBase extends BaseNode {
1078
+ +type: 'ExportNamedDeclaration';
1079
+ +declaration?: NamedDeclaration | null;
1080
+ +specifiers: $ReadOnlyArray<ExportSpecifier>;
1081
+ +source?: StringLiteral | null;
1082
+ +exportKind: 'value' | 'type';
1083
+ }
1084
+ export interface ExportNamedDeclarationWithSpecifiers
1085
+ extends ExportNamedDeclarationBase {
1086
+ +type: 'ExportNamedDeclaration';
1087
+ +declaration: null;
1088
+ +source?: StringLiteral | null;
1089
+ +specifiers: $ReadOnlyArray<ExportSpecifier>;
1090
+ }
1091
+ export interface ExportNamedDeclarationWithDeclaration
1092
+ extends ExportNamedDeclarationBase {
1093
+ +type: 'ExportNamedDeclaration';
1094
+ +declaration: NamedDeclaration;
1095
+ +source: null;
1096
+ +specifiers: [];
1097
+ }
1098
+ export type ExportNamedDeclaration =
1099
+ | ExportNamedDeclarationWithSpecifiers
1100
+ | ExportNamedDeclarationWithDeclaration;
1101
+
1102
+ export interface ExportSpecifier extends BaseNode {
1103
+ +type: 'ExportSpecifier';
1104
+ +exported: Identifier;
1105
+ +local: Identifier;
1106
+ }
1107
+
1108
+ export interface ExportDefaultDeclaration extends BaseNode {
1109
+ +type: 'ExportDefaultDeclaration';
1110
+ +declaration: DefaultDeclaration | Expression;
1111
+ }
1112
+
1113
+ export interface ExportAllDeclaration extends BaseNode {
1114
+ +type: 'ExportAllDeclaration';
1115
+ +source: StringLiteral;
1116
+ +exportKind: 'value' | 'type';
1117
+ +exported?: Identifier | null;
1118
+ }
1119
+
1120
+ export interface AwaitExpression extends BaseNode {
1121
+ +type: 'AwaitExpression';
1122
+ +argument: Expression;
1123
+ }
1124
+
1125
+ /***********************
1126
+ * Flow specific nodes *
1127
+ ***********************/
1128
+
1129
+ export type TypeAnnotationType =
1130
+ | NumberTypeAnnotation
1131
+ | StringTypeAnnotation
1132
+ | BigIntTypeAnnotation
1133
+ | BooleanTypeAnnotation
1134
+ | NullLiteralTypeAnnotation
1135
+ | AnyTypeAnnotation
1136
+ | EmptyTypeAnnotation
1137
+ | SymbolTypeAnnotation
1138
+ | ThisTypeAnnotation
1139
+ | MixedTypeAnnotation
1140
+ | VoidTypeAnnotation
1141
+ | StringLiteralTypeAnnotation
1142
+ | NumberLiteralTypeAnnotation
1143
+ | BigIntLiteralTypeAnnotation
1144
+ | BooleanLiteralTypeAnnotation
1145
+ | ArrayTypeAnnotation
1146
+ | NullableTypeAnnotation
1147
+ | ExistsTypeAnnotation
1148
+ | GenericTypeAnnotation
1149
+ | QualifiedTypeIdentifier
1150
+ | QualifiedTypeofIdentifier
1151
+ | TypeofTypeAnnotation
1152
+ | KeyofTypeAnnotation
1153
+ | TupleTypeAnnotation
1154
+ | TupleTypeSpreadElement
1155
+ | TupleTypeLabeledElement
1156
+ | InferTypeAnnotation
1157
+ | InterfaceTypeAnnotation
1158
+ | UnionTypeAnnotation
1159
+ | IntersectionTypeAnnotation
1160
+ | ConditionalTypeAnnotation
1161
+ | TypeOperator
1162
+ | TypePredicate
1163
+ | FunctionTypeAnnotation
1164
+ | HookTypeAnnotation
1165
+ | ComponentTypeAnnotation
1166
+ | ObjectTypeAnnotation
1167
+ | IndexedAccessType
1168
+ | OptionalIndexedAccessType;
1169
+
1170
+ export interface Variance extends BaseNode {
1171
+ +type: 'Variance';
1172
+ +kind: 'plus' | 'minus';
1173
+ }
1174
+
1175
+ interface BaseTypeAlias extends BaseNode {
1176
+ +id: Identifier;
1177
+ +typeParameters: null | TypeParameterDeclaration;
1178
+ +right: TypeAnnotationType;
1179
+ }
1180
+
1181
+ export interface TypeAnnotation extends BaseNode {
1182
+ +type: 'TypeAnnotation';
1183
+ +typeAnnotation: TypeAnnotationType;
1184
+ }
1185
+
1186
+ export interface TypeAlias extends BaseTypeAlias {
1187
+ +type: 'TypeAlias';
1188
+ }
1189
+
1190
+ interface BaseOpaqueType extends BaseNode {
1191
+ +id: Identifier;
1192
+ +supertype: TypeAnnotationType | null;
1193
+ +typeParameters: TypeParameterDeclaration | null;
1194
+ }
1195
+ export interface OpaqueType extends BaseOpaqueType {
1196
+ +type: 'OpaqueType';
1197
+ +impltype: TypeAnnotationType;
1198
+ }
1199
+
1200
+ export interface NumberTypeAnnotation extends BaseNode {
1201
+ +type: 'NumberTypeAnnotation';
1202
+ }
1203
+ export interface StringTypeAnnotation extends BaseNode {
1204
+ +type: 'StringTypeAnnotation';
1205
+ }
1206
+ export interface BigIntTypeAnnotation extends BaseNode {
1207
+ +type: 'BigIntTypeAnnotation';
1208
+ }
1209
+ export interface BooleanTypeAnnotation extends BaseNode {
1210
+ +type: 'BooleanTypeAnnotation';
1211
+ }
1212
+ export interface NullLiteralTypeAnnotation extends BaseNode {
1213
+ +type: 'NullLiteralTypeAnnotation';
1214
+ }
1215
+ export interface AnyTypeAnnotation extends BaseNode {
1216
+ +type: 'AnyTypeAnnotation';
1217
+ }
1218
+ export interface EmptyTypeAnnotation extends BaseNode {
1219
+ +type: 'EmptyTypeAnnotation';
1220
+ }
1221
+ export interface SymbolTypeAnnotation extends BaseNode {
1222
+ +type: 'SymbolTypeAnnotation';
1223
+ }
1224
+ export interface ThisTypeAnnotation extends BaseNode {
1225
+ +type: 'ThisTypeAnnotation';
1226
+ }
1227
+ export interface MixedTypeAnnotation extends BaseNode {
1228
+ +type: 'MixedTypeAnnotation';
1229
+ }
1230
+ export interface VoidTypeAnnotation extends BaseNode {
1231
+ +type: 'VoidTypeAnnotation';
1232
+ }
1233
+ export interface StringLiteralTypeAnnotation extends BaseNode {
1234
+ +type: 'StringLiteralTypeAnnotation';
1235
+ +value: string;
1236
+ +raw: string;
1237
+ }
1238
+ export interface NumberLiteralTypeAnnotation extends BaseNode {
1239
+ +type: 'NumberLiteralTypeAnnotation';
1240
+ +value: number;
1241
+ +raw: string;
1242
+ }
1243
+ export interface BigIntLiteralTypeAnnotation extends BaseNode {
1244
+ +type: 'BigIntLiteralTypeAnnotation';
1245
+ +bigint: string;
1246
+ +value: bigint;
1247
+ +raw: string;
1248
+ }
1249
+ export interface BooleanLiteralTypeAnnotation extends BaseNode {
1250
+ +type: 'BooleanLiteralTypeAnnotation';
1251
+ +value: boolean;
1252
+ +raw: 'true' | 'false';
1253
+ }
1254
+ export interface ArrayTypeAnnotation extends BaseNode {
1255
+ +type: 'ArrayTypeAnnotation';
1256
+ +elementType: TypeAnnotationType;
1257
+ }
1258
+ export interface NullableTypeAnnotation extends BaseNode {
1259
+ +type: 'NullableTypeAnnotation';
1260
+ +typeAnnotation: TypeAnnotationType;
1261
+ }
1262
+ export interface ExistsTypeAnnotation extends BaseNode {
1263
+ +type: 'ExistsTypeAnnotation';
1264
+ }
1265
+ export interface GenericTypeAnnotation extends BaseNode {
1266
+ +type: 'GenericTypeAnnotation';
1267
+ +id: Identifier | QualifiedTypeIdentifier;
1268
+ +typeParameters: null | TypeParameterInstantiation;
1269
+ }
1270
+ export interface QualifiedTypeIdentifier extends BaseNode {
1271
+ +type: 'QualifiedTypeIdentifier';
1272
+ +id: Identifier;
1273
+ +qualification: QualifiedTypeIdentifier | Identifier;
1274
+ }
1275
+ export interface QualifiedTypeofIdentifier extends BaseNode {
1276
+ +type: 'QualifiedTypeofIdentifier';
1277
+ +id: Identifier;
1278
+ +qualification: QualifiedTypeofIdentifier | Identifier;
1279
+ }
1280
+ export interface TypeofTypeAnnotation extends BaseNode {
1281
+ +type: 'TypeofTypeAnnotation';
1282
+ +argument: QualifiedTypeofIdentifier | Identifier;
1283
+ +typeArguments?: TypeParameterInstantiation;
1284
+ }
1285
+ export interface KeyofTypeAnnotation extends BaseNode {
1286
+ +type: 'KeyofTypeAnnotation';
1287
+ +argument: TypeAnnotationType;
1288
+ }
1289
+ export interface TupleTypeAnnotation extends BaseNode {
1290
+ +type: 'TupleTypeAnnotation';
1291
+ +types: $ReadOnlyArray<TypeAnnotationType>;
1292
+ +inexact: boolean;
1293
+ }
1294
+ export interface TupleTypeSpreadElement extends BaseNode {
1295
+ +type: 'TupleTypeSpreadElement';
1296
+ +label?: Identifier | null;
1297
+ +typeAnnotation: TypeAnnotationType;
1298
+ }
1299
+ export interface TupleTypeLabeledElement extends BaseNode {
1300
+ +type: 'TupleTypeLabeledElement';
1301
+ +label: Identifier;
1302
+ +elementType: TypeAnnotationType;
1303
+ +optional: boolean;
1304
+ +variance: Variance | null;
1305
+ }
1306
+
1307
+ export interface InferTypeAnnotation extends BaseNode {
1308
+ +type: 'InferTypeAnnotation';
1309
+ +typeParameter: TypeParameter;
1310
+ }
1311
+
1312
+ // type T = { [[foo]]: number };
1313
+ export interface ObjectTypeInternalSlot extends BaseNode {
1314
+ +type: 'ObjectTypeInternalSlot';
1315
+ +id: Identifier;
1316
+ +optional: boolean;
1317
+ +static: boolean;
1318
+ +method: boolean;
1319
+ +value: TypeAnnotation;
1320
+
1321
+ +parent: ObjectTypeAnnotation;
1322
+ }
1323
+
1324
+ export interface InterfaceTypeAnnotation extends BaseInterfaceNode {
1325
+ +type: 'InterfaceTypeAnnotation';
1326
+ }
1327
+
1328
+ export interface UnionTypeAnnotation extends BaseNode {
1329
+ +type: 'UnionTypeAnnotation';
1330
+ +types: $ReadOnlyArray<TypeAnnotationType>;
1331
+ }
1332
+ export interface IntersectionTypeAnnotation extends BaseNode {
1333
+ +type: 'IntersectionTypeAnnotation';
1334
+ +types: $ReadOnlyArray<TypeAnnotationType>;
1335
+ }
1336
+
1337
+ export interface ConditionalTypeAnnotation extends BaseNode {
1338
+ +type: 'ConditionalTypeAnnotation';
1339
+ +checkType: TypeAnnotationType;
1340
+ +extendsType: TypeAnnotationType;
1341
+ +trueType: TypeAnnotationType;
1342
+ +falseType: TypeAnnotationType;
1343
+ }
1344
+
1345
+ export type TypeOperator =
1346
+ | RendersTypeOperator
1347
+ | RendersStarTypeOperator
1348
+ | RendersQuestionTypeOperator;
1349
+
1350
+ export type RendersType =
1351
+ | RendersTypeOperator
1352
+ | RendersStarTypeOperator
1353
+ | RendersQuestionTypeOperator;
1354
+
1355
+ interface TypeOperatorBase extends BaseNode {
1356
+ +type: 'TypeOperator';
1357
+ +typeAnnotation: TypeAnnotationType;
1358
+ }
1359
+ export interface RendersTypeOperator extends TypeOperatorBase {
1360
+ +type: 'TypeOperator';
1361
+ +operator: 'renders';
1362
+ }
1363
+ export interface RendersStarTypeOperator extends TypeOperatorBase {
1364
+ +type: 'TypeOperator';
1365
+ +operator: 'renders*';
1366
+ }
1367
+ export interface RendersQuestionTypeOperator extends TypeOperatorBase {
1368
+ +type: 'TypeOperator';
1369
+ +operator: 'renders?';
1370
+ }
1371
+
1372
+ export interface TypePredicate extends BaseNode {
1373
+ +type: 'TypePredicate';
1374
+ +parameterName: Identifier;
1375
+ +typeAnnotation: TypeAnnotationType | null;
1376
+ +kind: null | 'asserts' | 'implies';
1377
+ }
1378
+
1379
+ export interface FunctionTypeAnnotation extends BaseNode {
1380
+ +type: 'FunctionTypeAnnotation';
1381
+ +params: $ReadOnlyArray<FunctionTypeParam>;
1382
+ +returnType: TypeAnnotationType;
1383
+ +rest: null | FunctionTypeParam;
1384
+ +typeParameters: null | TypeParameterDeclaration;
1385
+ +this: FunctionTypeParam | null;
1386
+ }
1387
+ export interface FunctionTypeParam extends BaseNode {
1388
+ +type: 'FunctionTypeParam';
1389
+ +name: Identifier | null;
1390
+ +typeAnnotation: TypeAnnotationType;
1391
+ +optional: boolean;
1392
+
1393
+ +parent: FunctionTypeAnnotation;
1394
+ }
1395
+ export interface HookTypeAnnotation extends BaseNode {
1396
+ +type: 'HookTypeAnnotation';
1397
+ +params: $ReadOnlyArray<FunctionTypeParam>;
1398
+ +returnType: TypeAnnotationType;
1399
+ +rest: null | FunctionTypeParam;
1400
+ +typeParameters: null | TypeParameterDeclaration;
1401
+ }
1402
+
1403
+ export interface ComponentTypeAnnotation extends BaseNode {
1404
+ +type: 'ComponentTypeAnnotation';
1405
+ +params: $ReadOnlyArray<ComponentTypeParameter>;
1406
+ +rest: null | ComponentTypeParameter;
1407
+ +typeParameters: null | TypeParameterDeclaration;
1408
+ +rendersType: null | RendersType;
1409
+ }
1410
+ export interface ComponentTypeParameter extends BaseNode {
1411
+ +type: 'ComponentTypeParameter';
1412
+ +name: Identifier | StringLiteral | null;
1413
+ +typeAnnotation: TypeAnnotationType;
1414
+ +optional: boolean;
1415
+
1416
+ +parent: ComponentTypeAnnotation | DeclareComponent;
1417
+ }
1418
+
1419
+ export interface InferredPredicate extends BaseNode {
1420
+ +type: 'InferredPredicate';
1421
+
1422
+ +parent: AFunction | DeclareFunction;
1423
+ }
1424
+
1425
+ export interface ObjectTypeAnnotation extends BaseNode {
1426
+ +type: 'ObjectTypeAnnotation';
1427
+ +inexact: boolean;
1428
+ +exact: boolean;
1429
+ +properties: $ReadOnlyArray<
1430
+ | ObjectTypeProperty
1431
+ | ObjectTypeSpreadProperty
1432
+ | ObjectTypeMappedTypeProperty,
1433
+ >;
1434
+ +indexers: $ReadOnlyArray<ObjectTypeIndexer>;
1435
+ +callProperties: $ReadOnlyArray<ObjectTypeCallProperty>;
1436
+ +internalSlots: $ReadOnlyArray<ObjectTypeInternalSlot>;
1437
+ }
1438
+ interface ObjectTypePropertyBase extends BaseNode {
1439
+ +type: 'ObjectTypeProperty';
1440
+ +key: Identifier | StringLiteral;
1441
+ +value: TypeAnnotationType;
1442
+ +method: boolean;
1443
+ +optional: boolean;
1444
+ +static: boolean; // only applies to the "declare class" case
1445
+ +proto: boolean; // only applies to the "declare class" case
1446
+ +variance: Variance | null;
1447
+ +kind: 'init' | 'get' | 'set';
1448
+
1449
+ +parent: ObjectTypeAnnotation;
1450
+ }
1451
+ export interface ObjectTypeMethodSignature extends ObjectTypePropertyBase {
1452
+ +type: 'ObjectTypeProperty';
1453
+ +value: FunctionTypeAnnotation;
1454
+ +method: true;
1455
+ +optional: false;
1456
+ +variance: null;
1457
+ +kind: 'init';
1458
+
1459
+ +parent: ObjectTypeAnnotation;
1460
+ }
1461
+ export interface ObjectTypePropertySignature extends ObjectTypePropertyBase {
1462
+ +type: 'ObjectTypeProperty';
1463
+ +value: TypeAnnotationType;
1464
+ +method: false;
1465
+ +optional: boolean;
1466
+ +variance: Variance | null;
1467
+ +kind: 'init';
1468
+
1469
+ +parent: ObjectTypeAnnotation;
1470
+ }
1471
+ export interface ObjectTypeAccessorSignature extends ObjectTypePropertyBase {
1472
+ +type: 'ObjectTypeProperty';
1473
+ +value: FunctionTypeAnnotation;
1474
+ +method: false;
1475
+ +optional: false;
1476
+ +variance: null;
1477
+ +kind: 'get' | 'set';
1478
+
1479
+ +parent: ObjectTypeAnnotation;
1480
+ }
1481
+ export type ObjectTypeProperty =
1482
+ | ObjectTypeMethodSignature
1483
+ | ObjectTypePropertySignature
1484
+ | ObjectTypeAccessorSignature;
1485
+
1486
+ export interface ObjectTypeCallProperty extends BaseNode {
1487
+ +type: 'ObjectTypeCallProperty';
1488
+ +value: FunctionTypeAnnotation;
1489
+ +static: boolean; // can only be static when defined on a declare class
1490
+
1491
+ +parent: ObjectTypeAnnotation;
1492
+ }
1493
+ export interface ObjectTypeIndexer extends BaseNode {
1494
+ +type: 'ObjectTypeIndexer';
1495
+ +id: null | Identifier;
1496
+ +key: TypeAnnotationType;
1497
+ +value: TypeAnnotationType;
1498
+ +static: boolean; // can only be static when defined on a declare class
1499
+ +variance: null | Variance;
1500
+
1501
+ +parent: ObjectTypeAnnotation;
1502
+ }
1503
+ export interface ObjectTypeMappedTypeProperty extends BaseNode {
1504
+ +type: 'ObjectTypeMappedTypeProperty';
1505
+ +keyTparam: TypeParameter;
1506
+ +propType: TypeAnnotationType;
1507
+ +sourceType: TypeAnnotationType;
1508
+ +variance: null | Variance;
1509
+ +optional: null | 'PlusOptional' | 'MinusOptional' | 'Optional';
1510
+
1511
+ +parent: ObjectTypeAnnotation;
1512
+ }
1513
+
1514
+ export interface ObjectTypeSpreadProperty extends BaseNode {
1515
+ +type: 'ObjectTypeSpreadProperty';
1516
+ +argument: TypeAnnotationType;
1517
+
1518
+ +parent: ObjectTypeAnnotation;
1519
+ }
1520
+
1521
+ export interface IndexedAccessType extends BaseNode {
1522
+ +type: 'IndexedAccessType';
1523
+ +objectType: TypeAnnotationType;
1524
+ +indexType: TypeAnnotationType;
1525
+ }
1526
+ export interface OptionalIndexedAccessType extends BaseNode {
1527
+ +type: 'OptionalIndexedAccessType';
1528
+ +objectType: TypeAnnotationType;
1529
+ +indexType: TypeAnnotationType;
1530
+ +optional: boolean;
1531
+ }
1532
+
1533
+ export interface TypeCastExpression extends BaseNode {
1534
+ +type: 'TypeCastExpression';
1535
+ +expression: Expression;
1536
+ +typeAnnotation: TypeAnnotation;
1537
+ }
1538
+ export interface AsExpression extends BaseNode {
1539
+ +type: 'AsExpression';
1540
+ +expression: Expression;
1541
+ +typeAnnotation: TypeAnnotationType;
1542
+ }
1543
+ export interface AsConstExpression extends BaseNode {
1544
+ +type: 'AsConstExpression';
1545
+ +expression: Expression;
1546
+ }
1547
+
1548
+ interface BaseInterfaceNode extends BaseNode {
1549
+ +body: ObjectTypeAnnotation;
1550
+ +extends: $ReadOnlyArray<InterfaceExtends>;
1551
+ }
1552
+ interface BaseInterfaceDeclaration extends BaseInterfaceNode {
1553
+ +id: Identifier;
1554
+ +typeParameters: null | TypeParameterDeclaration;
1555
+ }
1556
+
1557
+ export interface InterfaceDeclaration extends BaseInterfaceDeclaration {
1558
+ +type: 'InterfaceDeclaration';
1559
+ }
1560
+
1561
+ export interface InterfaceExtends extends BaseNode {
1562
+ +type: 'InterfaceExtends';
1563
+ +id: Identifier | QualifiedTypeIdentifier;
1564
+ +typeParameters: null | TypeParameterInstantiation;
1565
+
1566
+ +parent: InterfaceDeclaration | DeclareInterface;
1567
+ }
1568
+
1569
+ export interface ClassImplements extends BaseNode {
1570
+ +type: 'ClassImplements';
1571
+ +id: Identifier;
1572
+ +typeParameters: null | TypeParameterInstantiation;
1573
+
1574
+ +parent: AClass | DeclareClass;
1575
+ }
1576
+
1577
+ export interface Decorator extends BaseNode {
1578
+ +type: 'Decorator';
1579
+ +expression: Expression;
1580
+
1581
+ +parent: AClass;
1582
+ }
1583
+
1584
+ export interface TypeParameterDeclaration extends BaseNode {
1585
+ +type: 'TypeParameterDeclaration';
1586
+ +params: $ReadOnlyArray<TypeParameter>;
1587
+ }
1588
+ export interface TypeParameter extends BaseNode {
1589
+ +type: 'TypeParameter';
1590
+ +name: string;
1591
+ +bound: null | TypeAnnotation;
1592
+ +variance: null | Variance;
1593
+ +default: null | TypeAnnotationType;
1594
+ +usesExtendsBound: boolean;
1595
+ +parent: TypeParameterDeclaration;
1596
+ }
1597
+ export interface TypeParameterInstantiation extends BaseNode {
1598
+ +type: 'TypeParameterInstantiation';
1599
+ +params: $ReadOnlyArray<TypeAnnotationType>;
1600
+
1601
+ +parent: GenericTypeAnnotation | CallExpression | NewExpression;
1602
+ }
1603
+
1604
+ export interface EnumDeclaration extends BaseNode {
1605
+ +type: 'EnumDeclaration';
1606
+ +id: Identifier;
1607
+ +body:
1608
+ | EnumNumberBody
1609
+ | EnumBigIntBody
1610
+ | EnumStringBody
1611
+ | EnumBooleanBody
1612
+ | EnumSymbolBody;
1613
+ }
1614
+
1615
+ interface BaseEnumBody extends BaseNode {
1616
+ +hasUnknownMembers: boolean;
1617
+ }
1618
+ interface BaseInferrableEnumBody extends BaseEnumBody {
1619
+ +explicitType: boolean;
1620
+ }
1621
+
1622
+ export interface EnumNumberBody extends BaseInferrableEnumBody {
1623
+ +type: 'EnumNumberBody';
1624
+ // enum number members cannot be defaulted
1625
+ +members: $ReadOnlyArray<EnumNumberMember>;
1626
+ +explicitType: boolean;
1627
+
1628
+ +parent: EnumDeclaration;
1629
+ }
1630
+
1631
+ export interface EnumNumberMember extends BaseNode {
1632
+ +type: 'EnumNumberMember';
1633
+ +id: Identifier;
1634
+ +init: NumericLiteral;
1635
+
1636
+ +parent: EnumNumberBody;
1637
+ }
1638
+
1639
+ export interface EnumBigIntBody extends BaseInferrableEnumBody {
1640
+ +type: 'EnumBigIntBody';
1641
+ // enum bigint members cannot be defaulted
1642
+ +members: $ReadOnlyArray<EnumBigIntMember>;
1643
+ +explicitType: boolean;
1644
+
1645
+ +parent: EnumDeclaration;
1646
+ }
1647
+
1648
+ export interface EnumBigIntMember extends BaseNode {
1649
+ +type: 'EnumBigIntMember';
1650
+ +id: Identifier;
1651
+ +init: BigIntLiteral;
1652
+
1653
+ +parent: EnumBigIntBody;
1654
+ }
1655
+
1656
+ export interface EnumStringBody extends BaseInferrableEnumBody {
1657
+ +type: 'EnumStringBody';
1658
+ +members: $ReadOnlyArray<EnumStringMember | EnumDefaultedMember>;
1659
+
1660
+ +parent: EnumDeclaration;
1661
+ }
1662
+
1663
+ export interface EnumStringMember extends BaseNode {
1664
+ +type: 'EnumStringMember';
1665
+ +id: Identifier;
1666
+ +init: StringLiteral;
1667
+
1668
+ +parent: EnumStringBody;
1669
+ }
1670
+
1671
+ export interface EnumBooleanBody extends BaseInferrableEnumBody {
1672
+ +type: 'EnumBooleanBody';
1673
+ // enum boolean members cannot be defaulted
1674
+ +members: $ReadOnlyArray<EnumBooleanMember>;
1675
+
1676
+ +parent: EnumDeclaration;
1677
+ }
1678
+
1679
+ export interface EnumBooleanMember extends BaseNode {
1680
+ +type: 'EnumBooleanMember';
1681
+ +id: Identifier;
1682
+ +init: BooleanLiteral;
1683
+
1684
+ +parent: EnumBooleanBody;
1685
+ }
1686
+
1687
+ export interface EnumSymbolBody extends BaseEnumBody {
1688
+ +type: 'EnumSymbolBody';
1689
+ // enum symbol members can only be defaulted
1690
+ +members: $ReadOnlyArray<EnumDefaultedMember>;
1691
+
1692
+ +parent: EnumDeclaration;
1693
+ }
1694
+
1695
+ export interface EnumDefaultedMember extends BaseNode {
1696
+ +type: 'EnumDefaultedMember';
1697
+ +id: Identifier;
1698
+
1699
+ +parent: EnumStringBody | EnumSymbolBody;
1700
+ }
1701
+
1702
+ /*****************
1703
+ * Declare nodes *
1704
+ *****************/
1705
+
1706
+ export type DeclaredNode =
1707
+ | DeclareClass
1708
+ | DeclareComponent
1709
+ | DeclareHook
1710
+ | DeclareVariable
1711
+ | DeclareEnum
1712
+ | DeclareFunction
1713
+ | DeclareModule
1714
+ | DeclareInterface
1715
+ | DeclareTypeAlias
1716
+ | DeclareOpaqueType
1717
+ | DeclareExportAllDeclaration
1718
+ | DeclareExportDeclaration
1719
+ | DeclareModuleExports
1720
+ | DeclaredPredicate;
1721
+
1722
+ export interface DeclareClass extends BaseNode {
1723
+ +type: 'DeclareClass';
1724
+ +id: Identifier;
1725
+ +typeParameters: null | TypeParameterDeclaration;
1726
+ +extends: $ReadOnlyArray<InterfaceExtends>;
1727
+ +implements: $ReadOnlyArray<ClassImplements>;
1728
+ +body: ObjectTypeAnnotation;
1729
+ +mixins: $ReadOnlyArray<InterfaceExtends>;
1730
+ }
1731
+
1732
+ export interface DeclareComponent extends BaseNode {
1733
+ +type: 'DeclareComponent';
1734
+ +id: Identifier;
1735
+ +params: Array<ComponentTypeParameter>;
1736
+ +rest: null | ComponentTypeParameter;
1737
+ +typeParameters: null | TypeParameterDeclaration;
1738
+ +rendersType: null | RendersType;
1739
+ }
1740
+
1741
+ export interface DeclareHook extends BaseNode {
1742
+ +type: 'DeclareHook';
1743
+ // the hook signature is stored as a type annotation on the ID
1744
+ +id: interface extends Identifier {
1745
+ +typeAnnotation: interface extends TypeAnnotation {
1746
+ +typeAnnotation: HookTypeAnnotation,
1747
+ },
1748
+ };
1749
+ }
1750
+
1751
+ export interface DeclareVariable extends BaseNode {
1752
+ +type: 'DeclareVariable';
1753
+ +id: Identifier;
1754
+ +kind: 'var' | 'let' | 'const';
1755
+ }
1756
+
1757
+ export interface DeclareEnum extends BaseNode {
1758
+ +type: 'DeclareEnum';
1759
+ +id: Identifier;
1760
+ +body: EnumNumberBody | EnumStringBody | EnumBooleanBody | EnumSymbolBody;
1761
+ }
1762
+
1763
+ export interface DeclareFunction extends BaseNode {
1764
+ +type: 'DeclareFunction';
1765
+ // the function signature is stored as a type annotation on the ID
1766
+ +id: interface extends Identifier {
1767
+ +typeAnnotation: interface extends TypeAnnotation {
1768
+ +typeAnnotation: FunctionTypeAnnotation,
1769
+ },
1770
+ };
1771
+ +predicate: InferredPredicate | DeclaredPredicate | null;
1772
+ }
1773
+
1774
+ export interface DeclareModule extends BaseNode {
1775
+ +type: 'DeclareModule';
1776
+ +id: StringLiteral | Identifier;
1777
+ +body: BlockStatement;
1778
+ }
1779
+
1780
+ export interface DeclareNamespace extends BaseNode {
1781
+ +type: 'DeclareNamespace';
1782
+ +id: Identifier;
1783
+ +body: BlockStatement;
1784
+ }
1785
+
1786
+ export interface DeclareInterface extends BaseInterfaceDeclaration {
1787
+ +type: 'DeclareInterface';
1788
+ }
1789
+
1790
+ export interface DeclareTypeAlias extends BaseTypeAlias {
1791
+ +type: 'DeclareTypeAlias';
1792
+ }
1793
+
1794
+ export interface DeclareOpaqueType extends BaseOpaqueType {
1795
+ +type: 'DeclareOpaqueType';
1796
+ +impltype: null;
1797
+ }
1798
+
1799
+ export interface DeclareExportAllDeclaration extends BaseNode {
1800
+ +type: 'DeclareExportAllDeclaration';
1801
+ +source: StringLiteral;
1802
+ }
1803
+
1804
+ interface DeclareExportDeclarationBase extends BaseNode {
1805
+ +type: 'DeclareExportDeclaration';
1806
+ +specifiers: $ReadOnlyArray<ExportSpecifier>;
1807
+ +source: StringLiteral | null;
1808
+ +default: boolean;
1809
+ }
1810
+ export interface DeclareExportDefaultDeclaration
1811
+ extends DeclareExportDeclarationBase {
1812
+ +type: 'DeclareExportDeclaration';
1813
+ +declaration:
1814
+ | DeclareClass
1815
+ | DeclareFunction
1816
+ | DeclareComponent
1817
+ | DeclareHook
1818
+ | TypeAnnotationType;
1819
+ +default: true;
1820
+ // default cannot have a source
1821
+ +source: null;
1822
+ // default cannot have specifiers
1823
+ +specifiers: [];
1824
+ }
1825
+ export interface DeclareExportDeclarationNamedWithDeclaration
1826
+ extends DeclareExportDeclarationBase {
1827
+ +type: 'DeclareExportDeclaration';
1828
+ +declaration:
1829
+ | DeclareClass
1830
+ | DeclareFunction
1831
+ | DeclareComponent
1832
+ | DeclareHook
1833
+ | DeclareInterface
1834
+ | DeclareOpaqueType
1835
+ | DeclareVariable
1836
+ | DeclareEnum;
1837
+ +default: false;
1838
+ +source: null;
1839
+ // default cannot have specifiers and a declaration
1840
+ +specifiers: [];
1841
+ }
1842
+ export interface DeclareExportDeclarationNamedWithSpecifiers
1843
+ extends DeclareExportDeclarationBase {
1844
+ +type: 'DeclareExportDeclaration';
1845
+ // with a source you can't have a declaration
1846
+ +declaration: null;
1847
+ +default: false;
1848
+ +source: StringLiteral;
1849
+ +specifiers: $ReadOnlyArray<ExportSpecifier>;
1850
+ }
1851
+ export type DeclareExportDeclaration =
1852
+ | DeclareExportDefaultDeclaration
1853
+ | DeclareExportDeclarationNamedWithDeclaration
1854
+ | DeclareExportDeclarationNamedWithSpecifiers;
1855
+
1856
+ export interface DeclareModuleExports extends BaseNode {
1857
+ +type: 'DeclareModuleExports';
1858
+ +typeAnnotation: TypeAnnotation;
1859
+ }
1860
+
1861
+ export interface DeclaredPredicate extends BaseNode {
1862
+ +type: 'DeclaredPredicate';
1863
+ +value: Expression;
1864
+ }
1865
+
1866
+ /**********************
1867
+ * JSX specific nodes *
1868
+ **********************/
1869
+
1870
+ export type JSXChild =
1871
+ | JSXElement
1872
+ | JSXExpression
1873
+ | JSXFragment
1874
+ | JSXText
1875
+ | JSXSpreadChild;
1876
+ export type JSXExpression = JSXEmptyExpression | JSXExpressionContainer;
1877
+ export type JSXTagNameExpression =
1878
+ | JSXIdentifier
1879
+ | JSXMemberExpression
1880
+ | JSXNamespacedName;
1881
+
1882
+ export type JSXNode =
1883
+ | JSXAttribute
1884
+ | JSXClosingElement
1885
+ | JSXClosingFragment
1886
+ | JSXElement
1887
+ | JSXEmptyExpression
1888
+ | JSXExpressionContainer
1889
+ | JSXFragment
1890
+ | JSXIdentifier
1891
+ | JSXMemberExpression
1892
+ | JSXNamespacedName
1893
+ | JSXOpeningElement
1894
+ | JSXOpeningFragment
1895
+ | JSXSpreadAttribute
1896
+ | JSXText
1897
+ | JSXSpreadChild;
1898
+
1899
+ export interface JSXAttribute extends BaseNode {
1900
+ +type: 'JSXAttribute';
1901
+ +name: JSXIdentifier;
1902
+ +value: Literal | JSXExpression | null;
1903
+
1904
+ +parent: JSXOpeningElement;
1905
+ }
1906
+
1907
+ export interface JSXClosingElement extends BaseNode {
1908
+ +type: 'JSXClosingElement';
1909
+ +name: JSXTagNameExpression;
1910
+
1911
+ +parent: JSXElement;
1912
+ }
1913
+
1914
+ export interface JSXClosingFragment extends BaseNode {
1915
+ +type: 'JSXClosingFragment';
1916
+
1917
+ +parent: JSXFragment;
1918
+ }
1919
+
1920
+ export interface JSXElement extends BaseNode {
1921
+ +type: 'JSXElement';
1922
+ +openingElement: JSXOpeningElement;
1923
+ +closingElement: JSXClosingElement | null;
1924
+ +children: $ReadOnlyArray<JSXChild>;
1925
+ }
1926
+
1927
+ export interface JSXEmptyExpression extends BaseNode {
1928
+ +type: 'JSXEmptyExpression';
1929
+ }
1930
+
1931
+ export interface JSXExpressionContainer extends BaseNode {
1932
+ +type: 'JSXExpressionContainer';
1933
+ +expression: Expression | JSXEmptyExpression;
1934
+ }
1935
+
1936
+ export interface JSXFragment extends BaseNode {
1937
+ +type: 'JSXFragment';
1938
+ +openingFragment: JSXOpeningFragment;
1939
+ +closingFragment: JSXClosingFragment;
1940
+ +children: $ReadOnlyArray<JSXChild>;
1941
+ }
1942
+
1943
+ export interface JSXIdentifier extends BaseNode {
1944
+ +type: 'JSXIdentifier';
1945
+ +name: string;
1946
+ }
1947
+
1948
+ export interface JSXMemberExpression extends BaseNode {
1949
+ +type: 'JSXMemberExpression';
1950
+ +object: JSXTagNameExpression;
1951
+ +property: JSXIdentifier;
1952
+ }
1953
+
1954
+ export interface JSXNamespacedName extends BaseNode {
1955
+ +type: 'JSXNamespacedName';
1956
+ +namespace: JSXIdentifier;
1957
+ +name: JSXIdentifier;
1958
+ }
1959
+
1960
+ export interface JSXOpeningElement extends BaseNode {
1961
+ +type: 'JSXOpeningElement';
1962
+ +selfClosing: boolean;
1963
+ +name: JSXTagNameExpression;
1964
+ +attributes: $ReadOnlyArray<JSXAttribute | JSXSpreadAttribute>;
1965
+ +typeArguments?: TypeParameterInstantiation | null;
1966
+
1967
+ +parent: JSXElement;
1968
+ }
1969
+
1970
+ export interface JSXOpeningFragment extends BaseNode {
1971
+ +type: 'JSXOpeningFragment';
1972
+
1973
+ +parent: JSXFragment;
1974
+ }
1975
+
1976
+ export interface JSXSpreadAttribute extends BaseNode {
1977
+ +type: 'JSXSpreadAttribute';
1978
+ +argument: Expression;
1979
+
1980
+ +parent: JSXOpeningElement;
1981
+ }
1982
+
1983
+ export interface JSXText extends BaseNode {
1984
+ +type: 'JSXText';
1985
+ +value: string;
1986
+ +raw: string;
1987
+ }
1988
+
1989
+ export interface JSXSpreadChild extends BaseNode {
1990
+ +type: 'JSXSpreadChild';
1991
+ +expression: Expression;
1992
+ }
1993
+
1994
+ /******************************************************
1995
+ * Deprecated spec nodes awaiting migration by clawbot *
1996
+ ******************************************************/
1997
+
1998
+ export {};