@oxc-project/types 0.32.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,2010 @@
1
+ // Auto-generated code, DO NOT EDIT DIRECTLY!
2
+ // To edit this generated file you have to edit `tasks/ast_tools/src/generators/typescript.rs`
3
+
4
+ export interface FormalParameterRest extends Span {
5
+ type: 'RestElement';
6
+ argument: BindingPatternKind;
7
+ typeAnnotation: TSTypeAnnotation | null;
8
+ optional: boolean;
9
+ }
10
+
11
+ export type RegExpFlags = {
12
+ /** Global flag */
13
+ G: 1;
14
+ /** Ignore case flag */
15
+ I: 2;
16
+ /** Multiline flag */
17
+ M: 4;
18
+ /** DotAll flag */
19
+ S: 8;
20
+ /** Unicode flag */
21
+ U: 16;
22
+ /** Sticky flag */
23
+ Y: 32;
24
+ /** Indices flag */
25
+ D: 64;
26
+ /** Unicode sets flag */
27
+ V: 128;
28
+ };
29
+
30
+ export type JSXElementName =
31
+ | JSXIdentifier
32
+ | JSXNamespacedName
33
+ | JSXMemberExpression;
34
+
35
+ export type JSXMemberExpressionObject = JSXIdentifier | JSXMemberExpression;
36
+
37
+ export interface BooleanLiteral extends Span {
38
+ type: 'BooleanLiteral';
39
+ value: boolean;
40
+ }
41
+
42
+ export interface NullLiteral extends Span {
43
+ type: 'NullLiteral';
44
+ }
45
+
46
+ export interface NumericLiteral extends Span {
47
+ type: 'NumericLiteral';
48
+ value: number;
49
+ raw: string;
50
+ }
51
+
52
+ export interface BigIntLiteral extends Span {
53
+ type: 'BigIntLiteral';
54
+ raw: string;
55
+ }
56
+
57
+ export interface RegExpLiteral extends Span {
58
+ type: 'RegExpLiteral';
59
+ value: EmptyObject;
60
+ regex: RegExp;
61
+ }
62
+
63
+ export interface RegExp {
64
+ pattern: RegExpPattern;
65
+ flags: RegExpFlags;
66
+ }
67
+
68
+ export type RegExpPattern = string | string | Pattern;
69
+
70
+ export interface EmptyObject {
71
+ }
72
+
73
+ export interface StringLiteral extends Span {
74
+ type: 'StringLiteral';
75
+ value: string;
76
+ }
77
+
78
+ export interface Program extends Span {
79
+ type: 'Program';
80
+ sourceType: SourceType;
81
+ hashbang: Hashbang | null;
82
+ directives: Array<Directive>;
83
+ body: Array<Statement>;
84
+ }
85
+
86
+ export type Expression =
87
+ | BooleanLiteral
88
+ | NullLiteral
89
+ | NumericLiteral
90
+ | BigIntLiteral
91
+ | RegExpLiteral
92
+ | StringLiteral
93
+ | TemplateLiteral
94
+ | IdentifierReference
95
+ | MetaProperty
96
+ | Super
97
+ | ArrayExpression
98
+ | ArrowFunctionExpression
99
+ | AssignmentExpression
100
+ | AwaitExpression
101
+ | BinaryExpression
102
+ | CallExpression
103
+ | ChainExpression
104
+ | Class
105
+ | ConditionalExpression
106
+ | Function
107
+ | ImportExpression
108
+ | LogicalExpression
109
+ | NewExpression
110
+ | ObjectExpression
111
+ | ParenthesizedExpression
112
+ | SequenceExpression
113
+ | TaggedTemplateExpression
114
+ | ThisExpression
115
+ | UnaryExpression
116
+ | UpdateExpression
117
+ | YieldExpression
118
+ | PrivateInExpression
119
+ | JSXElement
120
+ | JSXFragment
121
+ | TSAsExpression
122
+ | TSSatisfiesExpression
123
+ | TSTypeAssertion
124
+ | TSNonNullExpression
125
+ | TSInstantiationExpression
126
+ | ComputedMemberExpression
127
+ | StaticMemberExpression
128
+ | PrivateFieldExpression;
129
+
130
+ export interface IdentifierName extends Span {
131
+ type: 'Identifier';
132
+ name: string;
133
+ }
134
+
135
+ export interface IdentifierReference extends Span {
136
+ type: 'Identifier';
137
+ name: string;
138
+ }
139
+
140
+ export interface BindingIdentifier extends Span {
141
+ type: 'Identifier';
142
+ name: string;
143
+ }
144
+
145
+ export interface LabelIdentifier extends Span {
146
+ type: 'Identifier';
147
+ name: string;
148
+ }
149
+
150
+ export interface ThisExpression extends Span {
151
+ type: 'ThisExpression';
152
+ }
153
+
154
+ export interface ArrayExpression extends Span {
155
+ type: 'ArrayExpression';
156
+ elements: Array<SpreadElement | Expression | null>;
157
+ }
158
+
159
+ export interface ObjectExpression extends Span {
160
+ type: 'ObjectExpression';
161
+ properties: Array<ObjectPropertyKind>;
162
+ }
163
+
164
+ export type ObjectPropertyKind = ObjectProperty | SpreadElement;
165
+
166
+ export interface ObjectProperty extends Span {
167
+ type: 'ObjectProperty';
168
+ kind: PropertyKind;
169
+ key: PropertyKey;
170
+ value: Expression;
171
+ init: Expression | null;
172
+ method: boolean;
173
+ shorthand: boolean;
174
+ computed: boolean;
175
+ }
176
+
177
+ export type PropertyKey =
178
+ | IdentifierName
179
+ | PrivateIdentifier
180
+ | BooleanLiteral
181
+ | NullLiteral
182
+ | NumericLiteral
183
+ | BigIntLiteral
184
+ | RegExpLiteral
185
+ | StringLiteral
186
+ | TemplateLiteral
187
+ | IdentifierReference
188
+ | MetaProperty
189
+ | Super
190
+ | ArrayExpression
191
+ | ArrowFunctionExpression
192
+ | AssignmentExpression
193
+ | AwaitExpression
194
+ | BinaryExpression
195
+ | CallExpression
196
+ | ChainExpression
197
+ | Class
198
+ | ConditionalExpression
199
+ | Function
200
+ | ImportExpression
201
+ | LogicalExpression
202
+ | NewExpression
203
+ | ObjectExpression
204
+ | ParenthesizedExpression
205
+ | SequenceExpression
206
+ | TaggedTemplateExpression
207
+ | ThisExpression
208
+ | UnaryExpression
209
+ | UpdateExpression
210
+ | YieldExpression
211
+ | PrivateInExpression
212
+ | JSXElement
213
+ | JSXFragment
214
+ | TSAsExpression
215
+ | TSSatisfiesExpression
216
+ | TSTypeAssertion
217
+ | TSNonNullExpression
218
+ | TSInstantiationExpression
219
+ | ComputedMemberExpression
220
+ | StaticMemberExpression
221
+ | PrivateFieldExpression;
222
+
223
+ export type PropertyKind = 'init' | 'get' | 'set';
224
+
225
+ export interface TemplateLiteral extends Span {
226
+ type: 'TemplateLiteral';
227
+ quasis: Array<TemplateElement>;
228
+ expressions: Array<Expression>;
229
+ }
230
+
231
+ export interface TaggedTemplateExpression extends Span {
232
+ type: 'TaggedTemplateExpression';
233
+ tag: Expression;
234
+ quasi: TemplateLiteral;
235
+ typeParameters: TSTypeParameterInstantiation | null;
236
+ }
237
+
238
+ export interface TemplateElement extends Span {
239
+ type: 'TemplateElement';
240
+ tail: boolean;
241
+ value: TemplateElementValue;
242
+ }
243
+
244
+ export interface TemplateElementValue {
245
+ raw: string;
246
+ cooked: string | null;
247
+ }
248
+
249
+ export type MemberExpression = ComputedMemberExpression | StaticMemberExpression | PrivateFieldExpression;
250
+
251
+ export interface ComputedMemberExpression extends Span {
252
+ type: 'ComputedMemberExpression';
253
+ object: Expression;
254
+ expression: Expression;
255
+ optional: boolean;
256
+ }
257
+
258
+ export interface StaticMemberExpression extends Span {
259
+ type: 'StaticMemberExpression';
260
+ object: Expression;
261
+ property: IdentifierName;
262
+ optional: boolean;
263
+ }
264
+
265
+ export interface PrivateFieldExpression extends Span {
266
+ type: 'PrivateFieldExpression';
267
+ object: Expression;
268
+ field: PrivateIdentifier;
269
+ optional: boolean;
270
+ }
271
+
272
+ export interface CallExpression extends Span {
273
+ type: 'CallExpression';
274
+ callee: Expression;
275
+ typeParameters: TSTypeParameterInstantiation | null;
276
+ arguments: Array<Argument>;
277
+ optional: boolean;
278
+ }
279
+
280
+ export interface NewExpression extends Span {
281
+ type: 'NewExpression';
282
+ callee: Expression;
283
+ arguments: Array<Argument>;
284
+ typeParameters: TSTypeParameterInstantiation | null;
285
+ }
286
+
287
+ export interface MetaProperty extends Span {
288
+ type: 'MetaProperty';
289
+ meta: IdentifierName;
290
+ property: IdentifierName;
291
+ }
292
+
293
+ export interface SpreadElement extends Span {
294
+ type: 'SpreadElement';
295
+ argument: Expression;
296
+ }
297
+
298
+ export type Argument =
299
+ | SpreadElement
300
+ | BooleanLiteral
301
+ | NullLiteral
302
+ | NumericLiteral
303
+ | BigIntLiteral
304
+ | RegExpLiteral
305
+ | StringLiteral
306
+ | TemplateLiteral
307
+ | IdentifierReference
308
+ | MetaProperty
309
+ | Super
310
+ | ArrayExpression
311
+ | ArrowFunctionExpression
312
+ | AssignmentExpression
313
+ | AwaitExpression
314
+ | BinaryExpression
315
+ | CallExpression
316
+ | ChainExpression
317
+ | Class
318
+ | ConditionalExpression
319
+ | Function
320
+ | ImportExpression
321
+ | LogicalExpression
322
+ | NewExpression
323
+ | ObjectExpression
324
+ | ParenthesizedExpression
325
+ | SequenceExpression
326
+ | TaggedTemplateExpression
327
+ | ThisExpression
328
+ | UnaryExpression
329
+ | UpdateExpression
330
+ | YieldExpression
331
+ | PrivateInExpression
332
+ | JSXElement
333
+ | JSXFragment
334
+ | TSAsExpression
335
+ | TSSatisfiesExpression
336
+ | TSTypeAssertion
337
+ | TSNonNullExpression
338
+ | TSInstantiationExpression
339
+ | ComputedMemberExpression
340
+ | StaticMemberExpression
341
+ | PrivateFieldExpression;
342
+
343
+ export interface UpdateExpression extends Span {
344
+ type: 'UpdateExpression';
345
+ operator: UpdateOperator;
346
+ prefix: boolean;
347
+ argument: SimpleAssignmentTarget;
348
+ }
349
+
350
+ export interface UnaryExpression extends Span {
351
+ type: 'UnaryExpression';
352
+ operator: UnaryOperator;
353
+ argument: Expression;
354
+ }
355
+
356
+ export interface BinaryExpression extends Span {
357
+ type: 'BinaryExpression';
358
+ left: Expression;
359
+ operator: BinaryOperator;
360
+ right: Expression;
361
+ }
362
+
363
+ export interface PrivateInExpression extends Span {
364
+ type: 'PrivateInExpression';
365
+ left: PrivateIdentifier;
366
+ operator: BinaryOperator;
367
+ right: Expression;
368
+ }
369
+
370
+ export interface LogicalExpression extends Span {
371
+ type: 'LogicalExpression';
372
+ left: Expression;
373
+ operator: LogicalOperator;
374
+ right: Expression;
375
+ }
376
+
377
+ export interface ConditionalExpression extends Span {
378
+ type: 'ConditionalExpression';
379
+ test: Expression;
380
+ consequent: Expression;
381
+ alternate: Expression;
382
+ }
383
+
384
+ export interface AssignmentExpression extends Span {
385
+ type: 'AssignmentExpression';
386
+ operator: AssignmentOperator;
387
+ left: AssignmentTarget;
388
+ right: Expression;
389
+ }
390
+
391
+ export type AssignmentTarget =
392
+ | IdentifierReference
393
+ | TSAsExpression
394
+ | TSSatisfiesExpression
395
+ | TSNonNullExpression
396
+ | TSTypeAssertion
397
+ | TSInstantiationExpression
398
+ | ComputedMemberExpression
399
+ | StaticMemberExpression
400
+ | PrivateFieldExpression
401
+ | ArrayAssignmentTarget
402
+ | ObjectAssignmentTarget;
403
+
404
+ export type SimpleAssignmentTarget =
405
+ | IdentifierReference
406
+ | TSAsExpression
407
+ | TSSatisfiesExpression
408
+ | TSNonNullExpression
409
+ | TSTypeAssertion
410
+ | TSInstantiationExpression
411
+ | ComputedMemberExpression
412
+ | StaticMemberExpression
413
+ | PrivateFieldExpression;
414
+
415
+ export type AssignmentTargetPattern = ArrayAssignmentTarget | ObjectAssignmentTarget;
416
+
417
+ export interface ArrayAssignmentTarget extends Span {
418
+ type: 'ArrayAssignmentTarget';
419
+ elements: Array<AssignmentTargetMaybeDefault | AssignmentTargetRest | null>;
420
+ }
421
+
422
+ export interface ObjectAssignmentTarget extends Span {
423
+ type: 'ObjectAssignmentTarget';
424
+ properties: Array<AssignmentTargetProperty | AssignmentTargetRest>;
425
+ }
426
+
427
+ export interface AssignmentTargetRest extends Span {
428
+ type: 'RestElement';
429
+ argument: AssignmentTarget;
430
+ }
431
+
432
+ export type AssignmentTargetMaybeDefault =
433
+ | AssignmentTargetWithDefault
434
+ | IdentifierReference
435
+ | TSAsExpression
436
+ | TSSatisfiesExpression
437
+ | TSNonNullExpression
438
+ | TSTypeAssertion
439
+ | TSInstantiationExpression
440
+ | ComputedMemberExpression
441
+ | StaticMemberExpression
442
+ | PrivateFieldExpression
443
+ | ArrayAssignmentTarget
444
+ | ObjectAssignmentTarget;
445
+
446
+ export interface AssignmentTargetWithDefault extends Span {
447
+ type: 'AssignmentTargetWithDefault';
448
+ binding: AssignmentTarget;
449
+ init: Expression;
450
+ }
451
+
452
+ export type AssignmentTargetProperty = AssignmentTargetPropertyIdentifier | AssignmentTargetPropertyProperty;
453
+
454
+ export interface AssignmentTargetPropertyIdentifier extends Span {
455
+ type: 'AssignmentTargetPropertyIdentifier';
456
+ binding: IdentifierReference;
457
+ init: Expression | null;
458
+ }
459
+
460
+ export interface AssignmentTargetPropertyProperty extends Span {
461
+ type: 'AssignmentTargetPropertyProperty';
462
+ name: PropertyKey;
463
+ binding: AssignmentTargetMaybeDefault;
464
+ }
465
+
466
+ export interface SequenceExpression extends Span {
467
+ type: 'SequenceExpression';
468
+ expressions: Array<Expression>;
469
+ }
470
+
471
+ export interface Super extends Span {
472
+ type: 'Super';
473
+ }
474
+
475
+ export interface AwaitExpression extends Span {
476
+ type: 'AwaitExpression';
477
+ argument: Expression;
478
+ }
479
+
480
+ export interface ChainExpression extends Span {
481
+ type: 'ChainExpression';
482
+ expression: ChainElement;
483
+ }
484
+
485
+ export type ChainElement = CallExpression | ComputedMemberExpression | StaticMemberExpression | PrivateFieldExpression;
486
+
487
+ export interface ParenthesizedExpression extends Span {
488
+ type: 'ParenthesizedExpression';
489
+ expression: Expression;
490
+ }
491
+
492
+ export type Statement =
493
+ | BlockStatement
494
+ | BreakStatement
495
+ | ContinueStatement
496
+ | DebuggerStatement
497
+ | DoWhileStatement
498
+ | EmptyStatement
499
+ | ExpressionStatement
500
+ | ForInStatement
501
+ | ForOfStatement
502
+ | ForStatement
503
+ | IfStatement
504
+ | LabeledStatement
505
+ | ReturnStatement
506
+ | SwitchStatement
507
+ | ThrowStatement
508
+ | TryStatement
509
+ | WhileStatement
510
+ | WithStatement
511
+ | VariableDeclaration
512
+ | Function
513
+ | Class
514
+ | TSTypeAliasDeclaration
515
+ | TSInterfaceDeclaration
516
+ | TSEnumDeclaration
517
+ | TSModuleDeclaration
518
+ | TSImportEqualsDeclaration
519
+ | ImportDeclaration
520
+ | ExportAllDeclaration
521
+ | ExportDefaultDeclaration
522
+ | ExportNamedDeclaration
523
+ | TSExportAssignment
524
+ | TSNamespaceExportDeclaration;
525
+
526
+ export interface Directive extends Span {
527
+ type: 'Directive';
528
+ expression: StringLiteral;
529
+ directive: string;
530
+ }
531
+
532
+ export interface Hashbang extends Span {
533
+ type: 'Hashbang';
534
+ value: string;
535
+ }
536
+
537
+ export interface BlockStatement extends Span {
538
+ type: 'BlockStatement';
539
+ body: Array<Statement>;
540
+ }
541
+
542
+ export type Declaration =
543
+ | VariableDeclaration
544
+ | Function
545
+ | Class
546
+ | TSTypeAliasDeclaration
547
+ | TSInterfaceDeclaration
548
+ | TSEnumDeclaration
549
+ | TSModuleDeclaration
550
+ | TSImportEqualsDeclaration;
551
+
552
+ export interface VariableDeclaration extends Span {
553
+ type: 'VariableDeclaration';
554
+ kind: VariableDeclarationKind;
555
+ declarations: Array<VariableDeclarator>;
556
+ declare: boolean;
557
+ }
558
+
559
+ export type VariableDeclarationKind = 'var' | 'const' | 'let' | 'using' | 'await using';
560
+
561
+ export interface VariableDeclarator extends Span {
562
+ type: 'VariableDeclarator';
563
+ id: BindingPattern;
564
+ init: Expression | null;
565
+ definite: boolean;
566
+ }
567
+
568
+ export interface EmptyStatement extends Span {
569
+ type: 'EmptyStatement';
570
+ }
571
+
572
+ export interface ExpressionStatement extends Span {
573
+ type: 'ExpressionStatement';
574
+ expression: Expression;
575
+ }
576
+
577
+ export interface IfStatement extends Span {
578
+ type: 'IfStatement';
579
+ test: Expression;
580
+ consequent: Statement;
581
+ alternate: Statement | null;
582
+ }
583
+
584
+ export interface DoWhileStatement extends Span {
585
+ type: 'DoWhileStatement';
586
+ body: Statement;
587
+ test: Expression;
588
+ }
589
+
590
+ export interface WhileStatement extends Span {
591
+ type: 'WhileStatement';
592
+ test: Expression;
593
+ body: Statement;
594
+ }
595
+
596
+ export interface ForStatement extends Span {
597
+ type: 'ForStatement';
598
+ init: ForStatementInit | null;
599
+ test: Expression | null;
600
+ update: Expression | null;
601
+ body: Statement;
602
+ }
603
+
604
+ export type ForStatementInit =
605
+ | VariableDeclaration
606
+ | BooleanLiteral
607
+ | NullLiteral
608
+ | NumericLiteral
609
+ | BigIntLiteral
610
+ | RegExpLiteral
611
+ | StringLiteral
612
+ | TemplateLiteral
613
+ | IdentifierReference
614
+ | MetaProperty
615
+ | Super
616
+ | ArrayExpression
617
+ | ArrowFunctionExpression
618
+ | AssignmentExpression
619
+ | AwaitExpression
620
+ | BinaryExpression
621
+ | CallExpression
622
+ | ChainExpression
623
+ | Class
624
+ | ConditionalExpression
625
+ | Function
626
+ | ImportExpression
627
+ | LogicalExpression
628
+ | NewExpression
629
+ | ObjectExpression
630
+ | ParenthesizedExpression
631
+ | SequenceExpression
632
+ | TaggedTemplateExpression
633
+ | ThisExpression
634
+ | UnaryExpression
635
+ | UpdateExpression
636
+ | YieldExpression
637
+ | PrivateInExpression
638
+ | JSXElement
639
+ | JSXFragment
640
+ | TSAsExpression
641
+ | TSSatisfiesExpression
642
+ | TSTypeAssertion
643
+ | TSNonNullExpression
644
+ | TSInstantiationExpression
645
+ | ComputedMemberExpression
646
+ | StaticMemberExpression
647
+ | PrivateFieldExpression;
648
+
649
+ export interface ForInStatement extends Span {
650
+ type: 'ForInStatement';
651
+ left: ForStatementLeft;
652
+ right: Expression;
653
+ body: Statement;
654
+ }
655
+
656
+ export type ForStatementLeft =
657
+ | VariableDeclaration
658
+ | IdentifierReference
659
+ | TSAsExpression
660
+ | TSSatisfiesExpression
661
+ | TSNonNullExpression
662
+ | TSTypeAssertion
663
+ | TSInstantiationExpression
664
+ | ComputedMemberExpression
665
+ | StaticMemberExpression
666
+ | PrivateFieldExpression
667
+ | ArrayAssignmentTarget
668
+ | ObjectAssignmentTarget;
669
+
670
+ export interface ForOfStatement extends Span {
671
+ type: 'ForOfStatement';
672
+ await: boolean;
673
+ left: ForStatementLeft;
674
+ right: Expression;
675
+ body: Statement;
676
+ }
677
+
678
+ export interface ContinueStatement extends Span {
679
+ type: 'ContinueStatement';
680
+ label: LabelIdentifier | null;
681
+ }
682
+
683
+ export interface BreakStatement extends Span {
684
+ type: 'BreakStatement';
685
+ label: LabelIdentifier | null;
686
+ }
687
+
688
+ export interface ReturnStatement extends Span {
689
+ type: 'ReturnStatement';
690
+ argument: Expression | null;
691
+ }
692
+
693
+ export interface WithStatement extends Span {
694
+ type: 'WithStatement';
695
+ object: Expression;
696
+ body: Statement;
697
+ }
698
+
699
+ export interface SwitchStatement extends Span {
700
+ type: 'SwitchStatement';
701
+ discriminant: Expression;
702
+ cases: Array<SwitchCase>;
703
+ }
704
+
705
+ export interface SwitchCase extends Span {
706
+ type: 'SwitchCase';
707
+ test: Expression | null;
708
+ consequent: Array<Statement>;
709
+ }
710
+
711
+ export interface LabeledStatement extends Span {
712
+ type: 'LabeledStatement';
713
+ label: LabelIdentifier;
714
+ body: Statement;
715
+ }
716
+
717
+ export interface ThrowStatement extends Span {
718
+ type: 'ThrowStatement';
719
+ argument: Expression;
720
+ }
721
+
722
+ export interface TryStatement extends Span {
723
+ type: 'TryStatement';
724
+ block: BlockStatement;
725
+ handler: CatchClause | null;
726
+ finalizer: BlockStatement | null;
727
+ }
728
+
729
+ export interface CatchClause extends Span {
730
+ type: 'CatchClause';
731
+ param: CatchParameter | null;
732
+ body: BlockStatement;
733
+ }
734
+
735
+ export interface CatchParameter extends Span {
736
+ type: 'CatchParameter';
737
+ pattern: BindingPattern;
738
+ }
739
+
740
+ export interface DebuggerStatement extends Span {
741
+ type: 'DebuggerStatement';
742
+ }
743
+
744
+ export type BindingPattern =
745
+ & ({
746
+ typeAnnotation: TSTypeAnnotation | null;
747
+ optional: boolean;
748
+ })
749
+ & (BindingIdentifier | ObjectPattern | ArrayPattern | AssignmentPattern);
750
+
751
+ export type BindingPatternKind = BindingIdentifier | ObjectPattern | ArrayPattern | AssignmentPattern;
752
+
753
+ export interface AssignmentPattern extends Span {
754
+ type: 'AssignmentPattern';
755
+ left: BindingPattern;
756
+ right: Expression;
757
+ }
758
+
759
+ export interface ObjectPattern extends Span {
760
+ type: 'ObjectPattern';
761
+ properties: Array<BindingProperty | BindingRestElement>;
762
+ }
763
+
764
+ export interface BindingProperty extends Span {
765
+ type: 'BindingProperty';
766
+ key: PropertyKey;
767
+ value: BindingPattern;
768
+ shorthand: boolean;
769
+ computed: boolean;
770
+ }
771
+
772
+ export interface ArrayPattern extends Span {
773
+ type: 'ArrayPattern';
774
+ elements: Array<BindingPattern | BindingRestElement | null>;
775
+ }
776
+
777
+ export interface BindingRestElement extends Span {
778
+ type: 'RestElement';
779
+ argument: BindingPattern;
780
+ }
781
+
782
+ export interface Function extends Span {
783
+ type: FunctionType;
784
+ id: BindingIdentifier | null;
785
+ generator: boolean;
786
+ async: boolean;
787
+ declare: boolean;
788
+ typeParameters: TSTypeParameterDeclaration | null;
789
+ thisParam: TSThisParameter | null;
790
+ params: FormalParameters;
791
+ returnType: TSTypeAnnotation | null;
792
+ body: FunctionBody | null;
793
+ }
794
+
795
+ export type FunctionType =
796
+ | 'FunctionDeclaration'
797
+ | 'FunctionExpression'
798
+ | 'TSDeclareFunction'
799
+ | 'TSEmptyBodyFunctionExpression';
800
+
801
+ export interface FormalParameters extends Span {
802
+ type: 'FormalParameters';
803
+ kind: FormalParameterKind;
804
+ items: Array<FormalParameter | FormalParameterRest>;
805
+ }
806
+
807
+ export interface FormalParameter extends Span {
808
+ type: 'FormalParameter';
809
+ decorators: Array<Decorator>;
810
+ pattern: BindingPattern;
811
+ accessibility: TSAccessibility | null;
812
+ readonly: boolean;
813
+ override: boolean;
814
+ }
815
+
816
+ export type FormalParameterKind = 'FormalParameter' | 'UniqueFormalParameters' | 'ArrowFormalParameters' | 'Signature';
817
+
818
+ export interface FunctionBody extends Span {
819
+ type: 'FunctionBody';
820
+ directives: Array<Directive>;
821
+ statements: Array<Statement>;
822
+ }
823
+
824
+ export interface ArrowFunctionExpression extends Span {
825
+ type: 'ArrowFunctionExpression';
826
+ expression: boolean;
827
+ async: boolean;
828
+ typeParameters: TSTypeParameterDeclaration | null;
829
+ params: FormalParameters;
830
+ returnType: TSTypeAnnotation | null;
831
+ body: FunctionBody;
832
+ }
833
+
834
+ export interface YieldExpression extends Span {
835
+ type: 'YieldExpression';
836
+ delegate: boolean;
837
+ argument: Expression | null;
838
+ }
839
+
840
+ export interface Class extends Span {
841
+ type: ClassType;
842
+ decorators: Array<Decorator>;
843
+ id: BindingIdentifier | null;
844
+ typeParameters: TSTypeParameterDeclaration | null;
845
+ superClass: Expression | null;
846
+ superTypeParameters: TSTypeParameterInstantiation | null;
847
+ implements: Array<TSClassImplements> | null;
848
+ body: ClassBody;
849
+ abstract: boolean;
850
+ declare: boolean;
851
+ }
852
+
853
+ export type ClassType = 'ClassDeclaration' | 'ClassExpression';
854
+
855
+ export interface ClassBody extends Span {
856
+ type: 'ClassBody';
857
+ body: Array<ClassElement>;
858
+ }
859
+
860
+ export type ClassElement = StaticBlock | MethodDefinition | PropertyDefinition | AccessorProperty | TSIndexSignature;
861
+
862
+ export interface MethodDefinition extends Span {
863
+ type: MethodDefinitionType;
864
+ decorators: Array<Decorator>;
865
+ key: PropertyKey;
866
+ value: Function;
867
+ kind: MethodDefinitionKind;
868
+ computed: boolean;
869
+ static: boolean;
870
+ override: boolean;
871
+ optional: boolean;
872
+ accessibility: TSAccessibility | null;
873
+ }
874
+
875
+ export type MethodDefinitionType = 'MethodDefinition' | 'TSAbstractMethodDefinition';
876
+
877
+ export interface PropertyDefinition extends Span {
878
+ type: PropertyDefinitionType;
879
+ decorators: Array<Decorator>;
880
+ key: PropertyKey;
881
+ value: Expression | null;
882
+ computed: boolean;
883
+ static: boolean;
884
+ declare: boolean;
885
+ override: boolean;
886
+ optional: boolean;
887
+ definite: boolean;
888
+ readonly: boolean;
889
+ typeAnnotation: TSTypeAnnotation | null;
890
+ accessibility: TSAccessibility | null;
891
+ }
892
+
893
+ export type PropertyDefinitionType = 'PropertyDefinition' | 'TSAbstractPropertyDefinition';
894
+
895
+ export type MethodDefinitionKind = 'constructor' | 'method' | 'get' | 'set';
896
+
897
+ export interface PrivateIdentifier extends Span {
898
+ type: 'PrivateIdentifier';
899
+ name: string;
900
+ }
901
+
902
+ export interface StaticBlock extends Span {
903
+ type: 'StaticBlock';
904
+ body: Array<Statement>;
905
+ }
906
+
907
+ export type ModuleDeclaration =
908
+ | ImportDeclaration
909
+ | ExportAllDeclaration
910
+ | ExportDefaultDeclaration
911
+ | ExportNamedDeclaration
912
+ | TSExportAssignment
913
+ | TSNamespaceExportDeclaration;
914
+
915
+ export type AccessorPropertyType = 'AccessorProperty' | 'TSAbstractAccessorProperty';
916
+
917
+ export interface AccessorProperty extends Span {
918
+ type: AccessorPropertyType;
919
+ decorators: Array<Decorator>;
920
+ key: PropertyKey;
921
+ value: Expression | null;
922
+ computed: boolean;
923
+ static: boolean;
924
+ definite: boolean;
925
+ typeAnnotation: TSTypeAnnotation | null;
926
+ accessibility: TSAccessibility | null;
927
+ }
928
+
929
+ export interface ImportExpression extends Span {
930
+ type: 'ImportExpression';
931
+ source: Expression;
932
+ arguments: Array<Expression>;
933
+ }
934
+
935
+ export interface ImportDeclaration extends Span {
936
+ type: 'ImportDeclaration';
937
+ specifiers: Array<ImportDeclarationSpecifier> | null;
938
+ source: StringLiteral;
939
+ withClause: WithClause | null;
940
+ importKind: ImportOrExportKind;
941
+ }
942
+
943
+ export type ImportDeclarationSpecifier = ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier;
944
+
945
+ export interface ImportSpecifier extends Span {
946
+ type: 'ImportSpecifier';
947
+ imported: ModuleExportName;
948
+ local: BindingIdentifier;
949
+ importKind: ImportOrExportKind;
950
+ }
951
+
952
+ export interface ImportDefaultSpecifier extends Span {
953
+ type: 'ImportDefaultSpecifier';
954
+ local: BindingIdentifier;
955
+ }
956
+
957
+ export interface ImportNamespaceSpecifier extends Span {
958
+ type: 'ImportNamespaceSpecifier';
959
+ local: BindingIdentifier;
960
+ }
961
+
962
+ export interface WithClause extends Span {
963
+ type: 'WithClause';
964
+ attributesKeyword: IdentifierName;
965
+ withEntries: Array<ImportAttribute>;
966
+ }
967
+
968
+ export interface ImportAttribute extends Span {
969
+ type: 'ImportAttribute';
970
+ key: ImportAttributeKey;
971
+ value: StringLiteral;
972
+ }
973
+
974
+ export type ImportAttributeKey = IdentifierName | StringLiteral;
975
+
976
+ export interface ExportNamedDeclaration extends Span {
977
+ type: 'ExportNamedDeclaration';
978
+ declaration: Declaration | null;
979
+ specifiers: Array<ExportSpecifier>;
980
+ source: StringLiteral | null;
981
+ exportKind: ImportOrExportKind;
982
+ withClause: WithClause | null;
983
+ }
984
+
985
+ export interface ExportDefaultDeclaration extends Span {
986
+ type: 'ExportDefaultDeclaration';
987
+ declaration: ExportDefaultDeclarationKind;
988
+ exported: ModuleExportName;
989
+ }
990
+
991
+ export interface ExportAllDeclaration extends Span {
992
+ type: 'ExportAllDeclaration';
993
+ exported: ModuleExportName | null;
994
+ source: StringLiteral;
995
+ withClause: WithClause | null;
996
+ exportKind: ImportOrExportKind;
997
+ }
998
+
999
+ export interface ExportSpecifier extends Span {
1000
+ type: 'ExportSpecifier';
1001
+ local: ModuleExportName;
1002
+ exported: ModuleExportName;
1003
+ exportKind: ImportOrExportKind;
1004
+ }
1005
+
1006
+ export type ExportDefaultDeclarationKind =
1007
+ | Function
1008
+ | Class
1009
+ | TSInterfaceDeclaration
1010
+ | BooleanLiteral
1011
+ | NullLiteral
1012
+ | NumericLiteral
1013
+ | BigIntLiteral
1014
+ | RegExpLiteral
1015
+ | StringLiteral
1016
+ | TemplateLiteral
1017
+ | IdentifierReference
1018
+ | MetaProperty
1019
+ | Super
1020
+ | ArrayExpression
1021
+ | ArrowFunctionExpression
1022
+ | AssignmentExpression
1023
+ | AwaitExpression
1024
+ | BinaryExpression
1025
+ | CallExpression
1026
+ | ChainExpression
1027
+ | Class
1028
+ | ConditionalExpression
1029
+ | Function
1030
+ | ImportExpression
1031
+ | LogicalExpression
1032
+ | NewExpression
1033
+ | ObjectExpression
1034
+ | ParenthesizedExpression
1035
+ | SequenceExpression
1036
+ | TaggedTemplateExpression
1037
+ | ThisExpression
1038
+ | UnaryExpression
1039
+ | UpdateExpression
1040
+ | YieldExpression
1041
+ | PrivateInExpression
1042
+ | JSXElement
1043
+ | JSXFragment
1044
+ | TSAsExpression
1045
+ | TSSatisfiesExpression
1046
+ | TSTypeAssertion
1047
+ | TSNonNullExpression
1048
+ | TSInstantiationExpression
1049
+ | ComputedMemberExpression
1050
+ | StaticMemberExpression
1051
+ | PrivateFieldExpression;
1052
+
1053
+ export type ModuleExportName = IdentifierName | IdentifierReference | StringLiteral;
1054
+
1055
+ export interface TSThisParameter extends Span {
1056
+ type: 'TSThisParameter';
1057
+ thisSpan: Span;
1058
+ typeAnnotation: TSTypeAnnotation | null;
1059
+ }
1060
+
1061
+ export interface TSEnumDeclaration extends Span {
1062
+ type: 'TSEnumDeclaration';
1063
+ id: BindingIdentifier;
1064
+ members: Array<TSEnumMember>;
1065
+ const: boolean;
1066
+ declare: boolean;
1067
+ }
1068
+
1069
+ export interface TSEnumMember extends Span {
1070
+ type: 'TSEnumMember';
1071
+ id: TSEnumMemberName;
1072
+ initializer: Expression | null;
1073
+ }
1074
+
1075
+ export type TSEnumMemberName =
1076
+ | IdentifierName
1077
+ | StringLiteral
1078
+ | TemplateLiteral
1079
+ | NumericLiteral
1080
+ | BooleanLiteral
1081
+ | NullLiteral
1082
+ | NumericLiteral
1083
+ | BigIntLiteral
1084
+ | RegExpLiteral
1085
+ | StringLiteral
1086
+ | TemplateLiteral
1087
+ | IdentifierReference
1088
+ | MetaProperty
1089
+ | Super
1090
+ | ArrayExpression
1091
+ | ArrowFunctionExpression
1092
+ | AssignmentExpression
1093
+ | AwaitExpression
1094
+ | BinaryExpression
1095
+ | CallExpression
1096
+ | ChainExpression
1097
+ | Class
1098
+ | ConditionalExpression
1099
+ | Function
1100
+ | ImportExpression
1101
+ | LogicalExpression
1102
+ | NewExpression
1103
+ | ObjectExpression
1104
+ | ParenthesizedExpression
1105
+ | SequenceExpression
1106
+ | TaggedTemplateExpression
1107
+ | ThisExpression
1108
+ | UnaryExpression
1109
+ | UpdateExpression
1110
+ | YieldExpression
1111
+ | PrivateInExpression
1112
+ | JSXElement
1113
+ | JSXFragment
1114
+ | TSAsExpression
1115
+ | TSSatisfiesExpression
1116
+ | TSTypeAssertion
1117
+ | TSNonNullExpression
1118
+ | TSInstantiationExpression
1119
+ | ComputedMemberExpression
1120
+ | StaticMemberExpression
1121
+ | PrivateFieldExpression;
1122
+
1123
+ export interface TSTypeAnnotation extends Span {
1124
+ type: 'TSTypeAnnotation';
1125
+ typeAnnotation: TSType;
1126
+ }
1127
+
1128
+ export interface TSLiteralType extends Span {
1129
+ type: 'TSLiteralType';
1130
+ literal: TSLiteral;
1131
+ }
1132
+
1133
+ export type TSLiteral =
1134
+ | BooleanLiteral
1135
+ | NullLiteral
1136
+ | NumericLiteral
1137
+ | BigIntLiteral
1138
+ | RegExpLiteral
1139
+ | StringLiteral
1140
+ | TemplateLiteral
1141
+ | UnaryExpression;
1142
+
1143
+ export type TSType =
1144
+ | TSAnyKeyword
1145
+ | TSBigIntKeyword
1146
+ | TSBooleanKeyword
1147
+ | TSIntrinsicKeyword
1148
+ | TSNeverKeyword
1149
+ | TSNullKeyword
1150
+ | TSNumberKeyword
1151
+ | TSObjectKeyword
1152
+ | TSStringKeyword
1153
+ | TSSymbolKeyword
1154
+ | TSUndefinedKeyword
1155
+ | TSUnknownKeyword
1156
+ | TSVoidKeyword
1157
+ | TSArrayType
1158
+ | TSConditionalType
1159
+ | TSConstructorType
1160
+ | TSFunctionType
1161
+ | TSImportType
1162
+ | TSIndexedAccessType
1163
+ | TSInferType
1164
+ | TSIntersectionType
1165
+ | TSLiteralType
1166
+ | TSMappedType
1167
+ | TSNamedTupleMember
1168
+ | TSQualifiedName
1169
+ | TSTemplateLiteralType
1170
+ | TSThisType
1171
+ | TSTupleType
1172
+ | TSTypeLiteral
1173
+ | TSTypeOperator
1174
+ | TSTypePredicate
1175
+ | TSTypeQuery
1176
+ | TSTypeReference
1177
+ | TSUnionType
1178
+ | TSParenthesizedType
1179
+ | JSDocNullableType
1180
+ | JSDocNonNullableType
1181
+ | JSDocUnknownType;
1182
+
1183
+ export interface TSConditionalType extends Span {
1184
+ type: 'TSConditionalType';
1185
+ checkType: TSType;
1186
+ extendsType: TSType;
1187
+ trueType: TSType;
1188
+ falseType: TSType;
1189
+ }
1190
+
1191
+ export interface TSUnionType extends Span {
1192
+ type: 'TSUnionType';
1193
+ types: Array<TSType>;
1194
+ }
1195
+
1196
+ export interface TSIntersectionType extends Span {
1197
+ type: 'TSIntersectionType';
1198
+ types: Array<TSType>;
1199
+ }
1200
+
1201
+ export interface TSParenthesizedType extends Span {
1202
+ type: 'TSParenthesizedType';
1203
+ typeAnnotation: TSType;
1204
+ }
1205
+
1206
+ export interface TSTypeOperator extends Span {
1207
+ type: 'TSTypeOperator';
1208
+ operator: TSTypeOperatorOperator;
1209
+ typeAnnotation: TSType;
1210
+ }
1211
+
1212
+ export type TSTypeOperatorOperator = 'keyof' | 'unique' | 'readonly';
1213
+
1214
+ export interface TSArrayType extends Span {
1215
+ type: 'TSArrayType';
1216
+ elementType: TSType;
1217
+ }
1218
+
1219
+ export interface TSIndexedAccessType extends Span {
1220
+ type: 'TSIndexedAccessType';
1221
+ objectType: TSType;
1222
+ indexType: TSType;
1223
+ }
1224
+
1225
+ export interface TSTupleType extends Span {
1226
+ type: 'TSTupleType';
1227
+ elementTypes: Array<TSTupleElement>;
1228
+ }
1229
+
1230
+ export interface TSNamedTupleMember extends Span {
1231
+ type: 'TSNamedTupleMember';
1232
+ elementType: TSTupleElement;
1233
+ label: IdentifierName;
1234
+ optional: boolean;
1235
+ }
1236
+
1237
+ export interface TSOptionalType extends Span {
1238
+ type: 'TSOptionalType';
1239
+ typeAnnotation: TSType;
1240
+ }
1241
+
1242
+ export interface TSRestType extends Span {
1243
+ type: 'TSRestType';
1244
+ typeAnnotation: TSType;
1245
+ }
1246
+
1247
+ export type TSTupleElement =
1248
+ | TSOptionalType
1249
+ | TSRestType
1250
+ | TSAnyKeyword
1251
+ | TSBigIntKeyword
1252
+ | TSBooleanKeyword
1253
+ | TSIntrinsicKeyword
1254
+ | TSNeverKeyword
1255
+ | TSNullKeyword
1256
+ | TSNumberKeyword
1257
+ | TSObjectKeyword
1258
+ | TSStringKeyword
1259
+ | TSSymbolKeyword
1260
+ | TSUndefinedKeyword
1261
+ | TSUnknownKeyword
1262
+ | TSVoidKeyword
1263
+ | TSArrayType
1264
+ | TSConditionalType
1265
+ | TSConstructorType
1266
+ | TSFunctionType
1267
+ | TSImportType
1268
+ | TSIndexedAccessType
1269
+ | TSInferType
1270
+ | TSIntersectionType
1271
+ | TSLiteralType
1272
+ | TSMappedType
1273
+ | TSNamedTupleMember
1274
+ | TSQualifiedName
1275
+ | TSTemplateLiteralType
1276
+ | TSThisType
1277
+ | TSTupleType
1278
+ | TSTypeLiteral
1279
+ | TSTypeOperator
1280
+ | TSTypePredicate
1281
+ | TSTypeQuery
1282
+ | TSTypeReference
1283
+ | TSUnionType
1284
+ | TSParenthesizedType
1285
+ | JSDocNullableType
1286
+ | JSDocNonNullableType
1287
+ | JSDocUnknownType;
1288
+
1289
+ export interface TSAnyKeyword extends Span {
1290
+ type: 'TSAnyKeyword';
1291
+ }
1292
+
1293
+ export interface TSStringKeyword extends Span {
1294
+ type: 'TSStringKeyword';
1295
+ }
1296
+
1297
+ export interface TSBooleanKeyword extends Span {
1298
+ type: 'TSBooleanKeyword';
1299
+ }
1300
+
1301
+ export interface TSNumberKeyword extends Span {
1302
+ type: 'TSNumberKeyword';
1303
+ }
1304
+
1305
+ export interface TSNeverKeyword extends Span {
1306
+ type: 'TSNeverKeyword';
1307
+ }
1308
+
1309
+ export interface TSIntrinsicKeyword extends Span {
1310
+ type: 'TSIntrinsicKeyword';
1311
+ }
1312
+
1313
+ export interface TSUnknownKeyword extends Span {
1314
+ type: 'TSUnknownKeyword';
1315
+ }
1316
+
1317
+ export interface TSNullKeyword extends Span {
1318
+ type: 'TSNullKeyword';
1319
+ }
1320
+
1321
+ export interface TSUndefinedKeyword extends Span {
1322
+ type: 'TSUndefinedKeyword';
1323
+ }
1324
+
1325
+ export interface TSVoidKeyword extends Span {
1326
+ type: 'TSVoidKeyword';
1327
+ }
1328
+
1329
+ export interface TSSymbolKeyword extends Span {
1330
+ type: 'TSSymbolKeyword';
1331
+ }
1332
+
1333
+ export interface TSThisType extends Span {
1334
+ type: 'TSThisType';
1335
+ }
1336
+
1337
+ export interface TSObjectKeyword extends Span {
1338
+ type: 'TSObjectKeyword';
1339
+ }
1340
+
1341
+ export interface TSBigIntKeyword extends Span {
1342
+ type: 'TSBigIntKeyword';
1343
+ }
1344
+
1345
+ export interface TSTypeReference extends Span {
1346
+ type: 'TSTypeReference';
1347
+ typeName: TSTypeName;
1348
+ typeParameters: TSTypeParameterInstantiation | null;
1349
+ }
1350
+
1351
+ export type TSTypeName = IdentifierReference | TSQualifiedName;
1352
+
1353
+ export interface TSQualifiedName extends Span {
1354
+ type: 'TSQualifiedName';
1355
+ left: TSTypeName;
1356
+ right: IdentifierName;
1357
+ }
1358
+
1359
+ export interface TSTypeParameterInstantiation extends Span {
1360
+ type: 'TSTypeParameterInstantiation';
1361
+ params: Array<TSType>;
1362
+ }
1363
+
1364
+ export interface TSTypeParameter extends Span {
1365
+ type: 'TSTypeParameter';
1366
+ name: BindingIdentifier;
1367
+ constraint: TSType | null;
1368
+ default: TSType | null;
1369
+ in: boolean;
1370
+ out: boolean;
1371
+ const: boolean;
1372
+ }
1373
+
1374
+ export interface TSTypeParameterDeclaration extends Span {
1375
+ type: 'TSTypeParameterDeclaration';
1376
+ params: Array<TSTypeParameter>;
1377
+ }
1378
+
1379
+ export interface TSTypeAliasDeclaration extends Span {
1380
+ type: 'TSTypeAliasDeclaration';
1381
+ id: BindingIdentifier;
1382
+ typeParameters: TSTypeParameterDeclaration | null;
1383
+ typeAnnotation: TSType;
1384
+ declare: boolean;
1385
+ }
1386
+
1387
+ export type TSAccessibility = 'private' | 'protected' | 'public';
1388
+
1389
+ export interface TSClassImplements extends Span {
1390
+ type: 'TSClassImplements';
1391
+ expression: TSTypeName;
1392
+ typeParameters: TSTypeParameterInstantiation | null;
1393
+ }
1394
+
1395
+ export interface TSInterfaceDeclaration extends Span {
1396
+ type: 'TSInterfaceDeclaration';
1397
+ id: BindingIdentifier;
1398
+ extends: Array<TSInterfaceHeritage> | null;
1399
+ typeParameters: TSTypeParameterDeclaration | null;
1400
+ body: TSInterfaceBody;
1401
+ declare: boolean;
1402
+ }
1403
+
1404
+ export interface TSInterfaceBody extends Span {
1405
+ type: 'TSInterfaceBody';
1406
+ body: Array<TSSignature>;
1407
+ }
1408
+
1409
+ export interface TSPropertySignature extends Span {
1410
+ type: 'TSPropertySignature';
1411
+ computed: boolean;
1412
+ optional: boolean;
1413
+ readonly: boolean;
1414
+ key: PropertyKey;
1415
+ typeAnnotation: TSTypeAnnotation | null;
1416
+ }
1417
+
1418
+ export type TSSignature =
1419
+ | TSIndexSignature
1420
+ | TSPropertySignature
1421
+ | TSCallSignatureDeclaration
1422
+ | TSConstructSignatureDeclaration
1423
+ | TSMethodSignature;
1424
+
1425
+ export interface TSIndexSignature extends Span {
1426
+ type: 'TSIndexSignature';
1427
+ parameters: Array<TSIndexSignatureName>;
1428
+ typeAnnotation: TSTypeAnnotation;
1429
+ readonly: boolean;
1430
+ }
1431
+
1432
+ export interface TSCallSignatureDeclaration extends Span {
1433
+ type: 'TSCallSignatureDeclaration';
1434
+ typeParameters: TSTypeParameterDeclaration | null;
1435
+ thisParam: TSThisParameter | null;
1436
+ params: FormalParameters;
1437
+ returnType: TSTypeAnnotation | null;
1438
+ }
1439
+
1440
+ export type TSMethodSignatureKind = 'method' | 'get' | 'set';
1441
+
1442
+ export interface TSMethodSignature extends Span {
1443
+ type: 'TSMethodSignature';
1444
+ key: PropertyKey;
1445
+ computed: boolean;
1446
+ optional: boolean;
1447
+ kind: TSMethodSignatureKind;
1448
+ typeParameters: TSTypeParameterDeclaration | null;
1449
+ thisParam: TSThisParameter | null;
1450
+ params: FormalParameters;
1451
+ returnType: TSTypeAnnotation | null;
1452
+ }
1453
+
1454
+ export interface TSConstructSignatureDeclaration extends Span {
1455
+ type: 'TSConstructSignatureDeclaration';
1456
+ typeParameters: TSTypeParameterDeclaration | null;
1457
+ params: FormalParameters;
1458
+ returnType: TSTypeAnnotation | null;
1459
+ }
1460
+
1461
+ export interface TSIndexSignatureName extends Span {
1462
+ type: 'Identifier';
1463
+ name: string;
1464
+ typeAnnotation: TSTypeAnnotation;
1465
+ }
1466
+
1467
+ export interface TSInterfaceHeritage extends Span {
1468
+ type: 'TSInterfaceHeritage';
1469
+ expression: Expression;
1470
+ typeParameters: TSTypeParameterInstantiation | null;
1471
+ }
1472
+
1473
+ export interface TSTypePredicate extends Span {
1474
+ type: 'TSTypePredicate';
1475
+ parameterName: TSTypePredicateName;
1476
+ asserts: boolean;
1477
+ typeAnnotation: TSTypeAnnotation | null;
1478
+ }
1479
+
1480
+ export type TSTypePredicateName = IdentifierName | TSThisType;
1481
+
1482
+ export interface TSModuleDeclaration extends Span {
1483
+ type: 'TSModuleDeclaration';
1484
+ id: TSModuleDeclarationName;
1485
+ body: TSModuleDeclarationBody | null;
1486
+ kind: TSModuleDeclarationKind;
1487
+ declare: boolean;
1488
+ }
1489
+
1490
+ export type TSModuleDeclarationKind = 'global' | 'module' | 'namespace';
1491
+
1492
+ export type TSModuleDeclarationName = BindingIdentifier | StringLiteral;
1493
+
1494
+ export type TSModuleDeclarationBody = TSModuleDeclaration | TSModuleBlock;
1495
+
1496
+ export interface TSModuleBlock extends Span {
1497
+ type: 'TSModuleBlock';
1498
+ body: Array<Statement>;
1499
+ }
1500
+
1501
+ export interface TSTypeLiteral extends Span {
1502
+ type: 'TSTypeLiteral';
1503
+ members: Array<TSSignature>;
1504
+ }
1505
+
1506
+ export interface TSInferType extends Span {
1507
+ type: 'TSInferType';
1508
+ typeParameter: TSTypeParameter;
1509
+ }
1510
+
1511
+ export interface TSTypeQuery extends Span {
1512
+ type: 'TSTypeQuery';
1513
+ exprName: TSTypeQueryExprName;
1514
+ typeParameters: TSTypeParameterInstantiation | null;
1515
+ }
1516
+
1517
+ export type TSTypeQueryExprName = TSImportType | IdentifierReference | TSQualifiedName;
1518
+
1519
+ export interface TSImportType extends Span {
1520
+ type: 'TSImportType';
1521
+ isTypeOf: boolean;
1522
+ parameter: TSType;
1523
+ qualifier: TSTypeName | null;
1524
+ attributes: TSImportAttributes | null;
1525
+ typeParameters: TSTypeParameterInstantiation | null;
1526
+ }
1527
+
1528
+ export interface TSImportAttributes extends Span {
1529
+ type: 'TSImportAttributes';
1530
+ attributesKeyword: IdentifierName;
1531
+ elements: Array<TSImportAttribute>;
1532
+ }
1533
+
1534
+ export interface TSImportAttribute extends Span {
1535
+ type: 'TSImportAttribute';
1536
+ name: TSImportAttributeName;
1537
+ value: Expression;
1538
+ }
1539
+
1540
+ export type TSImportAttributeName = IdentifierName | StringLiteral;
1541
+
1542
+ export interface TSFunctionType extends Span {
1543
+ type: 'TSFunctionType';
1544
+ typeParameters: TSTypeParameterDeclaration | null;
1545
+ thisParam: TSThisParameter | null;
1546
+ params: FormalParameters;
1547
+ returnType: TSTypeAnnotation;
1548
+ }
1549
+
1550
+ export interface TSConstructorType extends Span {
1551
+ type: 'TSConstructorType';
1552
+ abstract: boolean;
1553
+ typeParameters: TSTypeParameterDeclaration | null;
1554
+ params: FormalParameters;
1555
+ returnType: TSTypeAnnotation;
1556
+ }
1557
+
1558
+ export interface TSMappedType extends Span {
1559
+ type: 'TSMappedType';
1560
+ typeParameter: TSTypeParameter;
1561
+ nameType: TSType | null;
1562
+ typeAnnotation: TSType | null;
1563
+ optional: TSMappedTypeModifierOperator;
1564
+ readonly: TSMappedTypeModifierOperator;
1565
+ }
1566
+
1567
+ export type TSMappedTypeModifierOperator = 'true' | '+' | '-' | 'none';
1568
+
1569
+ export interface TSTemplateLiteralType extends Span {
1570
+ type: 'TSTemplateLiteralType';
1571
+ quasis: Array<TemplateElement>;
1572
+ types: Array<TSType>;
1573
+ }
1574
+
1575
+ export interface TSAsExpression extends Span {
1576
+ type: 'TSAsExpression';
1577
+ expression: Expression;
1578
+ typeAnnotation: TSType;
1579
+ }
1580
+
1581
+ export interface TSSatisfiesExpression extends Span {
1582
+ type: 'TSSatisfiesExpression';
1583
+ expression: Expression;
1584
+ typeAnnotation: TSType;
1585
+ }
1586
+
1587
+ export interface TSTypeAssertion extends Span {
1588
+ type: 'TSTypeAssertion';
1589
+ expression: Expression;
1590
+ typeAnnotation: TSType;
1591
+ }
1592
+
1593
+ export interface TSImportEqualsDeclaration extends Span {
1594
+ type: 'TSImportEqualsDeclaration';
1595
+ id: BindingIdentifier;
1596
+ moduleReference: TSModuleReference;
1597
+ importKind: ImportOrExportKind;
1598
+ }
1599
+
1600
+ export type TSModuleReference = TSExternalModuleReference | IdentifierReference | TSQualifiedName;
1601
+
1602
+ export interface TSExternalModuleReference extends Span {
1603
+ type: 'TSExternalModuleReference';
1604
+ expression: StringLiteral;
1605
+ }
1606
+
1607
+ export interface TSNonNullExpression extends Span {
1608
+ type: 'TSNonNullExpression';
1609
+ expression: Expression;
1610
+ }
1611
+
1612
+ export interface Decorator extends Span {
1613
+ type: 'Decorator';
1614
+ expression: Expression;
1615
+ }
1616
+
1617
+ export interface TSExportAssignment extends Span {
1618
+ type: 'TSExportAssignment';
1619
+ expression: Expression;
1620
+ }
1621
+
1622
+ export interface TSNamespaceExportDeclaration extends Span {
1623
+ type: 'TSNamespaceExportDeclaration';
1624
+ id: IdentifierName;
1625
+ }
1626
+
1627
+ export interface TSInstantiationExpression extends Span {
1628
+ type: 'TSInstantiationExpression';
1629
+ expression: Expression;
1630
+ typeParameters: TSTypeParameterInstantiation;
1631
+ }
1632
+
1633
+ export type ImportOrExportKind = 'value' | 'type';
1634
+
1635
+ export interface JSDocNullableType extends Span {
1636
+ type: 'JSDocNullableType';
1637
+ typeAnnotation: TSType;
1638
+ postfix: boolean;
1639
+ }
1640
+
1641
+ export interface JSDocNonNullableType extends Span {
1642
+ type: 'JSDocNonNullableType';
1643
+ typeAnnotation: TSType;
1644
+ postfix: boolean;
1645
+ }
1646
+
1647
+ export interface JSDocUnknownType extends Span {
1648
+ type: 'JSDocUnknownType';
1649
+ }
1650
+
1651
+ export interface JSXElement extends Span {
1652
+ type: 'JSXElement';
1653
+ openingElement: JSXOpeningElement;
1654
+ closingElement: JSXClosingElement | null;
1655
+ children: Array<JSXChild>;
1656
+ }
1657
+
1658
+ export interface JSXOpeningElement extends Span {
1659
+ type: 'JSXOpeningElement';
1660
+ selfClosing: boolean;
1661
+ name: JSXElementName;
1662
+ attributes: Array<JSXAttributeItem>;
1663
+ typeParameters: TSTypeParameterInstantiation | null;
1664
+ }
1665
+
1666
+ export interface JSXClosingElement extends Span {
1667
+ type: 'JSXClosingElement';
1668
+ name: JSXElementName;
1669
+ }
1670
+
1671
+ export interface JSXFragment extends Span {
1672
+ type: 'JSXFragment';
1673
+ openingFragment: JSXOpeningFragment;
1674
+ closingFragment: JSXClosingFragment;
1675
+ children: Array<JSXChild>;
1676
+ }
1677
+
1678
+ export interface JSXOpeningFragment extends Span {
1679
+ type: 'JSXOpeningFragment';
1680
+ }
1681
+
1682
+ export interface JSXClosingFragment extends Span {
1683
+ type: 'JSXClosingFragment';
1684
+ }
1685
+
1686
+ export interface JSXNamespacedName extends Span {
1687
+ type: 'JSXNamespacedName';
1688
+ namespace: JSXIdentifier;
1689
+ property: JSXIdentifier;
1690
+ }
1691
+
1692
+ export interface JSXMemberExpression extends Span {
1693
+ type: 'JSXMemberExpression';
1694
+ object: JSXMemberExpressionObject;
1695
+ property: JSXIdentifier;
1696
+ }
1697
+
1698
+ export interface JSXExpressionContainer extends Span {
1699
+ type: 'JSXExpressionContainer';
1700
+ expression: JSXExpression;
1701
+ }
1702
+
1703
+ export type JSXExpression =
1704
+ | JSXEmptyExpression
1705
+ | BooleanLiteral
1706
+ | NullLiteral
1707
+ | NumericLiteral
1708
+ | BigIntLiteral
1709
+ | RegExpLiteral
1710
+ | StringLiteral
1711
+ | TemplateLiteral
1712
+ | IdentifierReference
1713
+ | MetaProperty
1714
+ | Super
1715
+ | ArrayExpression
1716
+ | ArrowFunctionExpression
1717
+ | AssignmentExpression
1718
+ | AwaitExpression
1719
+ | BinaryExpression
1720
+ | CallExpression
1721
+ | ChainExpression
1722
+ | Class
1723
+ | ConditionalExpression
1724
+ | Function
1725
+ | ImportExpression
1726
+ | LogicalExpression
1727
+ | NewExpression
1728
+ | ObjectExpression
1729
+ | ParenthesizedExpression
1730
+ | SequenceExpression
1731
+ | TaggedTemplateExpression
1732
+ | ThisExpression
1733
+ | UnaryExpression
1734
+ | UpdateExpression
1735
+ | YieldExpression
1736
+ | PrivateInExpression
1737
+ | JSXElement
1738
+ | JSXFragment
1739
+ | TSAsExpression
1740
+ | TSSatisfiesExpression
1741
+ | TSTypeAssertion
1742
+ | TSNonNullExpression
1743
+ | TSInstantiationExpression
1744
+ | ComputedMemberExpression
1745
+ | StaticMemberExpression
1746
+ | PrivateFieldExpression;
1747
+
1748
+ export interface JSXEmptyExpression extends Span {
1749
+ type: 'JSXEmptyExpression';
1750
+ }
1751
+
1752
+ export type JSXAttributeItem = JSXAttribute | JSXSpreadAttribute;
1753
+
1754
+ export interface JSXAttribute extends Span {
1755
+ type: 'JSXAttribute';
1756
+ name: JSXAttributeName;
1757
+ value: JSXAttributeValue | null;
1758
+ }
1759
+
1760
+ export interface JSXSpreadAttribute extends Span {
1761
+ type: 'JSXSpreadAttribute';
1762
+ argument: Expression;
1763
+ }
1764
+
1765
+ export type JSXAttributeName = JSXIdentifier | JSXNamespacedName;
1766
+
1767
+ export type JSXAttributeValue = StringLiteral | JSXExpressionContainer | JSXElement | JSXFragment;
1768
+
1769
+ export interface JSXIdentifier extends Span {
1770
+ type: 'JSXIdentifier';
1771
+ name: string;
1772
+ }
1773
+
1774
+ export type JSXChild = JSXText | JSXElement | JSXFragment | JSXExpressionContainer | JSXSpreadChild;
1775
+
1776
+ export interface JSXSpreadChild extends Span {
1777
+ type: 'JSXSpreadChild';
1778
+ expression: Expression;
1779
+ }
1780
+
1781
+ export interface JSXText extends Span {
1782
+ type: 'JSXText';
1783
+ value: string;
1784
+ }
1785
+
1786
+ export type AssignmentOperator =
1787
+ | '='
1788
+ | '+='
1789
+ | '-='
1790
+ | '*='
1791
+ | '/='
1792
+ | '%='
1793
+ | '<<='
1794
+ | '>>='
1795
+ | '>>>='
1796
+ | '|='
1797
+ | '^='
1798
+ | '&='
1799
+ | '&&='
1800
+ | '||='
1801
+ | '??='
1802
+ | '**=';
1803
+
1804
+ export type BinaryOperator =
1805
+ | '=='
1806
+ | '!='
1807
+ | '==='
1808
+ | '!=='
1809
+ | '<'
1810
+ | '<='
1811
+ | '>'
1812
+ | '>='
1813
+ | '<<'
1814
+ | '>>'
1815
+ | '>>>'
1816
+ | '+'
1817
+ | '-'
1818
+ | '*'
1819
+ | '/'
1820
+ | '%'
1821
+ | '|'
1822
+ | '^'
1823
+ | '&'
1824
+ | 'in'
1825
+ | 'instanceof'
1826
+ | '**';
1827
+
1828
+ export type LogicalOperator = '||' | '&&' | '??';
1829
+
1830
+ export type UnaryOperator = '-' | '+' | '!' | '~' | 'typeof' | 'void' | 'delete';
1831
+
1832
+ export type UpdateOperator = '++' | '--';
1833
+
1834
+ export interface Span {
1835
+ start: number;
1836
+ end: number;
1837
+ }
1838
+
1839
+ export interface SourceType {
1840
+ language: Language;
1841
+ moduleKind: ModuleKind;
1842
+ variant: LanguageVariant;
1843
+ }
1844
+
1845
+ export type Language = 'javascript' | 'typescript' | 'typescriptDefinition';
1846
+
1847
+ export type ModuleKind = 'script' | 'module' | 'unambiguous';
1848
+
1849
+ export type LanguageVariant = 'standard' | 'jsx';
1850
+
1851
+ export interface Pattern extends Span {
1852
+ type: 'Pattern';
1853
+ body: Disjunction;
1854
+ }
1855
+
1856
+ export interface Disjunction extends Span {
1857
+ type: 'Disjunction';
1858
+ body: Array<Alternative>;
1859
+ }
1860
+
1861
+ export interface Alternative extends Span {
1862
+ type: 'Alternative';
1863
+ body: Array<Term>;
1864
+ }
1865
+
1866
+ export type Term =
1867
+ | BoundaryAssertion
1868
+ | LookAroundAssertion
1869
+ | Quantifier
1870
+ | Character
1871
+ | Dot
1872
+ | CharacterClassEscape
1873
+ | UnicodePropertyEscape
1874
+ | CharacterClass
1875
+ | CapturingGroup
1876
+ | IgnoreGroup
1877
+ | IndexedReference
1878
+ | NamedReference;
1879
+
1880
+ export interface BoundaryAssertion {
1881
+ type: 'BoundaryAssertion';
1882
+ span: Span;
1883
+ kind: BoundaryAssertionKind;
1884
+ }
1885
+
1886
+ export type BoundaryAssertionKind = 'start' | 'end' | 'boundary' | 'negativeBoundary';
1887
+
1888
+ export interface LookAroundAssertion extends Span {
1889
+ type: 'LookAroundAssertion';
1890
+ kind: LookAroundAssertionKind;
1891
+ body: Disjunction;
1892
+ }
1893
+
1894
+ export type LookAroundAssertionKind = 'lookahead' | 'negativeLookahead' | 'lookbehind' | 'negativeLookbehind';
1895
+
1896
+ export interface Quantifier extends Span {
1897
+ type: 'Quantifier';
1898
+ min: number;
1899
+ max: number | null;
1900
+ greedy: boolean;
1901
+ body: Term;
1902
+ }
1903
+
1904
+ export interface Character extends Span {
1905
+ type: 'Character';
1906
+ kind: CharacterKind;
1907
+ value: number;
1908
+ }
1909
+
1910
+ export type CharacterKind =
1911
+ | 'controlLetter'
1912
+ | 'hexadecimalEscape'
1913
+ | 'identifier'
1914
+ | 'null'
1915
+ | 'octal1'
1916
+ | 'octal2'
1917
+ | 'octal3'
1918
+ | 'singleEscape'
1919
+ | 'symbol'
1920
+ | 'unicodeEscape';
1921
+
1922
+ export interface CharacterClassEscape extends Span {
1923
+ type: 'CharacterClassEscape';
1924
+ kind: CharacterClassEscapeKind;
1925
+ }
1926
+
1927
+ export type CharacterClassEscapeKind = 'd' | 'negativeD' | 's' | 'negativeS' | 'w' | 'negativeW';
1928
+
1929
+ export interface UnicodePropertyEscape extends Span {
1930
+ type: 'UnicodePropertyEscape';
1931
+ negative: boolean;
1932
+ strings: boolean;
1933
+ name: string;
1934
+ value: string | null;
1935
+ }
1936
+
1937
+ export interface Dot extends Span {
1938
+ type: 'Dot';
1939
+ }
1940
+
1941
+ export interface CharacterClass extends Span {
1942
+ type: 'CharacterClass';
1943
+ negative: boolean;
1944
+ strings: boolean;
1945
+ kind: CharacterClassContentsKind;
1946
+ body: Array<CharacterClassContents>;
1947
+ }
1948
+
1949
+ export type CharacterClassContentsKind = 'union' | 'intersection' | 'subtraction';
1950
+
1951
+ export type CharacterClassContents =
1952
+ | CharacterClassRange
1953
+ | CharacterClassEscape
1954
+ | UnicodePropertyEscape
1955
+ | Character
1956
+ | CharacterClass
1957
+ | ClassStringDisjunction;
1958
+
1959
+ export interface CharacterClassRange extends Span {
1960
+ type: 'CharacterClassRange';
1961
+ min: Character;
1962
+ max: Character;
1963
+ }
1964
+
1965
+ export interface ClassStringDisjunction extends Span {
1966
+ type: 'ClassStringDisjunction';
1967
+ strings: boolean;
1968
+ body: Array<ClassString>;
1969
+ }
1970
+
1971
+ export interface ClassString extends Span {
1972
+ type: 'ClassString';
1973
+ strings: boolean;
1974
+ body: Array<Character>;
1975
+ }
1976
+
1977
+ export interface CapturingGroup extends Span {
1978
+ type: 'CapturingGroup';
1979
+ name: string | null;
1980
+ body: Disjunction;
1981
+ }
1982
+
1983
+ export interface IgnoreGroup extends Span {
1984
+ type: 'IgnoreGroup';
1985
+ modifiers: Modifiers | null;
1986
+ body: Disjunction;
1987
+ }
1988
+
1989
+ export interface Modifiers extends Span {
1990
+ type: 'Modifiers';
1991
+ enabling: Modifier | null;
1992
+ disabling: Modifier | null;
1993
+ }
1994
+
1995
+ export interface Modifier {
1996
+ type: 'Modifier';
1997
+ ignoreCase: boolean;
1998
+ multiline: boolean;
1999
+ sticky: boolean;
2000
+ }
2001
+
2002
+ export interface IndexedReference extends Span {
2003
+ type: 'IndexedReference';
2004
+ index: number;
2005
+ }
2006
+
2007
+ export interface NamedReference extends Span {
2008
+ type: 'NamedReference';
2009
+ name: string;
2010
+ }