1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
use serde_json::Value;
use std::any::Any;
use swc_atoms::JsWord;
use swc_estree_ast::*;
use swc_visit::define;
pub trait Node: Any {}
impl<T: ?Sized> Node for T where T: Any {}
define!({
pub enum Class {
Expr(ClassExpression),
Decl(ClassDeclaration),
}
pub enum ClassMethodKind {
Get,
Set,
Method,
Constructor,
}
pub struct ClassMethod {
pub base: BaseNode,
pub kind: Option<ClassMethodKind>,
pub key: ObjectKey,
pub params: Vec<Param>,
pub body: BlockStatement,
pub computed: Option<bool>,
pub is_static: Option<bool>,
pub generator: Option<bool>,
pub is_async: Option<bool>,
pub is_abstract: Option<bool>,
pub access: Option<Access>,
pub accessibility: Option<Access>,
pub decorators: Option<Vec<Decorator>>,
pub optional: Option<bool>,
pub return_type: Option<Box<TypeAnnotOrNoop>>,
pub type_parameters: Option<TypeParamDeclOrNoop>,
}
pub struct ClassPrivateProperty {
pub base: BaseNode,
pub key: PrivateName,
pub value: Option<Box<Expression>>,
pub decorators: Option<Vec<Decorator>>,
pub static_any: Value,
pub type_annotation: Option<Box<TypeAnnotOrNoop>>,
}
pub struct ClassPrivateMethod {
pub base: BaseNode,
pub kind: Option<ClassMethodKind>,
pub key: PrivateName,
pub params: Vec<Param>,
pub body: BlockStatement,
pub is_static: Option<bool>,
pub is_abstract: Option<bool>,
pub access: Option<Access>,
pub accessibility: Option<Access>,
pub is_async: Option<bool>,
pub computed: Option<bool>,
pub decorators: Option<Vec<Decorator>>,
pub generator: Option<bool>,
pub optional: Option<bool>,
pub return_type: Option<Box<TypeAnnotOrNoop>>,
pub type_parameters: Option<TypeParamDeclOrNoop>,
}
pub struct ClassProperty {
pub base: BaseNode,
pub key: ObjectKey,
pub value: Option<Box<Expression>>,
pub type_annotation: Option<Box<TypeAnnotOrNoop>>,
pub decorators: Option<Vec<Decorator>>,
pub computed: Option<bool>,
pub is_static: Option<bool>,
pub is_abstract: Option<bool>,
pub accessibility: Option<Access>,
pub declare: Option<bool>,
pub definite: Option<bool>,
pub optional: Option<bool>,
pub readonly: Option<bool>,
}
pub struct StaticBlock {
pub base: BaseNode,
pub body: Vec<Statement>,
}
pub enum ClassBodyEl {
Method(ClassMethod),
PrivateMethod(ClassPrivateMethod),
Prop(ClassProperty),
PrivateProp(ClassPrivateProperty),
TSMethod(TSDeclareMethod),
TSIndex(TSIndexSignature),
StaticBlock(StaticBlock),
}
pub struct ClassBody {
pub base: BaseNode,
pub body: Vec<ClassBodyEl>,
}
pub enum ClassImpl {
TSExpr(TSExpressionWithTypeArguments),
Implements(ClassImplements),
}
pub struct ClassDeclaration {
pub base: BaseNode,
pub id: Identifier,
pub super_class: Option<Box<Expression>>,
pub body: ClassBody,
pub decorators: Option<Vec<Decorator>>,
pub is_abstract: Option<bool>,
pub declare: Option<bool>,
pub implements: Option<Vec<ClassImpl>>,
pub mixins: Option<InterfaceExtends>,
pub super_type_parameters: Option<SuperTypeParams>,
pub type_parameters: Option<TypeParamDeclOrNoop>,
}
pub struct BaseComment {
pub value: String,
pub start: usize,
pub end: usize,
pub loc: Loc,
}
pub enum Comment {
Block(BaseComment),
Line(BaseComment),
}
pub enum CommentTypeShorthand {
Leading,
Inner,
Trailing,
}
pub struct LineCol {
pub line: usize,
pub column: usize,
}
pub struct Loc {
pub start: LineCol,
pub end: LineCol,
}
pub struct BaseNode {
pub leading_comments: Vec<Comment>,
pub inner_comments: Vec<Comment>,
pub trailing_comments: Vec<Comment>,
pub start: Option<usize>,
pub end: Option<usize>,
pub loc: Option<Loc>,
}
pub enum Binary {
BinaryExpr(BinaryExpression),
LogicalExpr(LogicalExpression),
}
pub enum Conditional {
Expr(ConditionalExpression),
If(IfStatement),
}
pub enum EnumBody {
Boolean(EnumBooleanBody),
Number(EnumNumberBody),
String(EnumStringBody),
Symbol(EnumSymbolBody),
}
pub enum EnumMember {
Boolean(EnumBooleanMember),
Number(EnumNumberMember),
String(EnumStringMember),
Defaulted(EnumDefaultedMember),
}
pub enum Function {
Decl(FunctionDeclaration),
Expr(FunctionExpression),
ObjectMethod(ObjectMethod),
Arrow(ArrowFunctionExpression),
ClassMethod(ClassMethod),
ClassPrivateMethod(ClassPrivateMethod),
}
pub enum FunctionParent {
Decl(FunctionDeclaration),
Expr(FunctionExpression),
ObjectMethod(ObjectMethod),
Arrow(ArrowFunctionExpression),
ClassMethod(ClassMethod),
ClassPrivateMethod(ClassPrivateMethod),
}
pub enum Immutable {
StringLiteral(StringLiteral),
NumericLiteral(NumericLiteral),
NullLiteral(NullLiteral),
BooleanLiteral(BooleanLiteral),
BigIntLiteral(BigIntLiteral),
JSXAttribute(JSXAttribute),
JSXClosingElement(JSXClosingElement),
JSXElement(JSXElement),
JSXExpressionContainer(JSXExpressionContainer),
JSXSpreadChild(JSXSpreadChild),
JSXOpeningElement(JSXOpeningElement),
JSXText(JSXText),
JSXFragment(JSXFragment),
JSXOpeningFragment(JSXOpeningFragment),
JSXClosingFragment(JSXClosingFragment),
DecimalLiteral(DecimalLiteral),
}
pub enum Method {
Object(ObjectMethod),
Class(ClassMethod),
ClassPrivate(ClassPrivateMethod),
}
pub enum Private {
ClassProp(ClassPrivateProperty),
ClassMethod(ClassPrivateMethod),
Name(PrivateName),
}
pub enum Property {
ObjectProp(ObjectProperty),
ClassProp(ClassProperty),
ClassPrivateProp(ClassPrivateProperty),
}
pub enum Pureish {
FunctionDecl(FunctionDeclaration),
FunctionExpr(FunctionExpression),
StringLiteral(StringLiteral),
NumericLiteral(NumericLiteral),
NullLiteral(NullLiteral),
BooleanLiteral(BooleanLiteral),
RegExpLiteral(RegExpLiteral),
ArrowFuncExpr(ArrowFunctionExpression),
BigIntLiteral(BigIntLiteral),
DecimalLiteral(DecimalLiteral),
}
pub enum Scopable {
BlockStmt(BlockStatement),
CatchClause(CatchClause),
DoWhileStmt(DoWhileStatement),
ForInStmt(ForInStatement),
ForStmt(ForStatement),
FuncDecl(FunctionDeclaration),
FuncExpr(FunctionExpression),
Program(Program),
ObjectMethod(ObjectMethod),
SwitchStmt(SwitchStatement),
WhileStmt(WhileStatement),
ArrowFuncExpr(ArrowFunctionExpression),
ClassExpr(ClassExpression),
ClassDecl(ClassDeclaration),
ForOfStmt(ForOfStatement),
ClassMethod(ClassMethod),
ClassPrivateMethod(ClassPrivateMethod),
StaticBlock(StaticBlock),
TSModuleBlock(TSModuleBlock),
}
pub enum BlockParent {
BlockStmt(BlockStatement),
CatchClause(CatchClause),
DoWhileStmt(DoWhileStatement),
ForInStmt(ForInStatement),
ForStmt(ForStatement),
FuncDecl(FunctionDeclaration),
FuncExpr(FunctionExpression),
Program(Program),
ObjectMethod(ObjectMethod),
SwitchStmt(SwitchStatement),
WhileStmt(WhileStatement),
ArrowFuncExpr(ArrowFunctionExpression),
ForOfStmt(ForOfStatement),
ClassMethod(ClassMethod),
ClassPrivateMethod(ClassPrivateMethod),
StaticBlock(StaticBlock),
TSModuleBlock(TSModuleBlock),
}
pub enum Block {
BlockStmt(BlockStatement),
Program(Program),
TSModuleBlock(TSModuleBlock),
}
pub enum Terminatorless {
Break(BreakStatement),
Continue(ContinueStatement),
Return(ReturnStatement),
Throw(ThrowStatement),
Yield(YieldExpression),
Await(AwaitExpression),
}
pub enum UnaryLike {
Expr(UnaryExpression),
Spread(SpreadElement),
}
pub struct SpreadElement {
pub base: BaseNode,
pub argument: Box<Expression>,
}
pub struct SpreadProperty {
pub base: BaseNode,
pub argument: Box<Expression>,
}
pub struct RestElement {
pub base: BaseNode,
pub argument: Box<LVal>,
pub decorators: Option<Vec<Decorator>>,
pub type_annotation: Option<Box<TypeAnnotOrNoop>>,
}
pub struct RestProperty {
pub base: BaseNode,
pub argument: LVal,
pub decorators: Option<Vec<Decorator>>,
pub type_annotation: Option<Box<TypeAnnotOrNoop>>,
}
pub struct Identifier {
pub base: BaseNode,
pub name: JsWord,
pub decorators: Option<Vec<Decorator>>,
pub optional: Option<bool>,
pub type_annotation: Option<Box<TypeAnnotOrNoop>>,
}
pub enum IdOrQualifiedId {
Id(Identifier),
QualifiedId(QualifiedTypeIdentifier),
}
pub enum IdOrString {
Id(Identifier),
String(StringLiteral),
}
pub enum IdOrRest {
Id(Identifier),
Rest(RestElement),
}
pub struct Decorator {
pub base: BaseNode,
pub expression: Box<Expression>,
}
pub struct Noop {
pub base: BaseNode,
}
pub enum Param {
Id(Identifier),
Pat(Pattern),
Rest(RestElement),
TSProp(TSParameterProperty),
}
pub enum LVal {
Id(Identifier),
MemberExpr(MemberExpression),
RestEl(RestElement),
AssignmentPat(AssignmentPattern),
ArrayPat(ArrayPattern),
ObjectPat(ObjectPattern),
TSParamProp(TSParameterProperty),
}
pub enum PatternLike {
Id(Identifier),
RestEl(RestElement),
AssignmentPat(AssignmentPattern),
ArrayPat(ArrayPattern),
ObjectPat(ObjectPattern),
}
pub enum TypeAnnotOrNoop {
Flow(TypeAnnotation),
TS(Box<TSTypeAnnotation>),
Noop(Noop),
}
pub enum TypeParamDeclOrNoop {
Flow(TypeParameterDeclaration),
TS(TSTypeParameterDeclaration),
Noop(Noop),
}
pub enum SuperTypeParams {
Flow(TypeParameterInstantiation),
TS(TSTypeParameterInstantiation),
}
pub struct PrivateName {
pub base: BaseNode,
pub id: Identifier,
}
pub enum Access {
Public,
Private,
Protected,
}
pub struct MetaProperty {
pub base: BaseNode,
pub meta: Identifier,
pub property: Identifier,
}
pub struct Directive {
pub base: BaseNode,
pub value: DirectiveLiteral,
}
pub struct DirectiveLiteral {
pub base: BaseNode,
pub value: JsWord,
}
pub struct PipelineBareFunction {
pub base: BaseNode,
pub callee: Box<Expression>,
}
pub struct PipelineTopicExpression {
pub base: BaseNode,
pub expression: Box<Expression>,
}
pub enum PlaceholderExpectedNode {
Identifier,
StringLiteral,
Expression,
Statement,
Declaration,
BlockStatement,
ClassBody,
Pattern,
}
pub struct Placeholder {
pub base: BaseNode,
pub expected_node: PlaceholderExpectedNode,
pub name: Identifier,
}
pub enum Declaration {
FuncDecl(FunctionDeclaration),
VarDecl(VariableDeclaration),
ClassDecl(ClassDeclaration),
ExportAllDecl(ExportAllDeclaration),
ExportDefaultDecl(ExportDefaultDeclaration),
ExportNamedDecl(ExportNamedDeclaration),
ImportDecl(ImportDeclaration),
DeclClass(DeclareClass),
DeclFunc(DeclareFunction),
DeclInterface(DeclareInterface),
DeclModule(DeclareModule),
DeclModuleExports(DeclareModuleExports),
DeclTypeAlias(DeclareTypeAlias),
DeclOpaqueType(DeclareOpaqueType),
DeclVar(DeclareVariable),
DeclExportDecl(DeclareExportDeclaration),
DeclExportAllDecl(DeclareExportAllDeclaration),
InterfaceDecl(InterfaceDeclaration),
OpaqueType(OpaqueType),
TypeAlias(TypeAlias),
EnumDecl(EnumDeclaration),
TSDeclFunc(TSDeclareFunction),
TSInterfaceDecl(TSInterfaceDeclaration),
TSTypeAliasDecl(TSTypeAliasDeclaration),
TSEnumDecl(TSEnumDeclaration),
TSModuleDecl(TSModuleDeclaration),
}
pub enum VariableDeclarationKind {
Var,
Let,
Const,
}
pub struct VariableDeclarator {
pub base: BaseNode,
pub id: LVal,
pub init: Option<Box<Expression>>,
pub definite: Option<bool>,
}
pub struct VariableDeclaration {
pub base: BaseNode,
pub kind: VariableDeclarationKind,
pub declarations: Vec<VariableDeclarator>,
pub declare: Option<bool>,
}
pub struct FunctionDeclaration {
pub base: BaseNode,
pub id: Option<Identifier>,
pub params: Vec<Param>,
pub body: BlockStatement,
pub generator: Option<bool>,
pub is_async: Option<bool>,
pub return_type: Option<Box<TypeAnnotOrNoop>>,
pub type_parameters: Option<TypeParamDeclOrNoop>,
}
pub struct EnumBooleanMember {
pub base: BaseNode,
pub id: Identifier,
pub init: BooleanLiteral,
}
pub struct EnumNumberMember {
pub base: BaseNode,
pub id: Identifier,
pub init: NumericLiteral,
}
pub struct EnumStringMember {
pub base: BaseNode,
pub id: Identifier,
pub init: StringLiteral,
}
pub enum EnumStringBodyMember {
String(EnumStringMember),
Defaulted(EnumDefaultedMember),
}
pub struct EnumDefaultedMember {
pub base: BaseNode,
pub id: Identifier,
}
pub struct EnumBooleanBody {
pub base: BaseNode,
pub members: Vec<EnumBooleanMember>,
pub explicit_type: bool,
pub has_unknown_members: bool,
}
pub struct EnumNumberBody {
pub base: BaseNode,
pub members: Vec<EnumNumberMember>,
pub explicit_type: bool,
pub has_unknown_members: bool,
}
pub struct EnumStringBody {
pub base: BaseNode,
pub members: Vec<EnumStringBodyMember>,
pub explicit_type: bool,
pub has_unknown_members: bool,
}
pub struct EnumSymbolBody {
pub base: BaseNode,
pub members: Vec<EnumDefaultedMember>,
pub has_unknown_members: bool,
}
pub enum EnumBody {
Boolean(EnumBooleanBody),
Number(EnumNumberBody),
String(EnumStringBody),
Symbol(EnumSymbolBody),
}
pub struct EnumDeclaration {
pub base: BaseNode,
pub id: Identifier,
pub body: EnumBody,
}
pub enum Expression {
Array(ArrayExpression),
Assignment(AssignmentExpression),
Binary(BinaryExpression),
Call(CallExpression),
Conditional(ConditionalExpression),
Func(FunctionExpression),
Id(Identifier),
StringLiteral(StringLiteral),
NumericLiteral(NumericLiteral),
NullLiteral(NullLiteral),
BooleanLiteral(BooleanLiteral),
RegExpLiteral(RegExpLiteral),
Logical(LogicalExpression),
Member(MemberExpression),
New(NewExpression),
Object(ObjectExpression),
Sequence(SequenceExpression),
Parenthesized(ParenthesizedExpression),
This(ThisExpression),
Unary(UnaryExpression),
Update(UpdateExpression),
ArrowFunc(ArrowFunctionExpression),
Class(ClassExpression),
MetaProp(MetaProperty),
Super(Super),
TaggedTemplate(TaggedTemplateExpression),
TemplateLiteral(TemplateLiteral),
Yield(YieldExpression),
Await(AwaitExpression),
Import(Import),
BigIntLiteral(BigIntLiteral),
OptionalMember(OptionalMemberExpression),
OptionalCall(OptionalCallExpression),
TypeCast(TypeCastExpression),
JSXElement(JSXElement),
JSXFragment(JSXFragment),
Bind(BindExpression),
PipelinePrimaryTopicRef(PipelinePrimaryTopicReference),
Do(DoExpression),
Record(RecordExpression),
Tuple(TupleExpression),
DecimalLiteral(DecimalLiteral),
Module(ModuleExpression),
TSAs(TSAsExpression),
TSTypeAssertion(TSTypeAssertion),
TSNonNull(TSNonNullExpression),
}
pub enum ExpressionWrapper {
Stmt(ExpressionStatement),
Parenthesized(ParenthesizedExpression),
TypeCast(TypeCastExpression),
}
pub enum ArrayExprEl {
Expr(Box<Expression>),
Spread(SpreadElement),
}
pub struct ArrayExpression {
pub base: BaseNode,
pub elements: Vec<Option<ArrayExprEl>>,
}
pub struct AssignmentExpression {
pub base: BaseNode,
pub operator: JsWord,
pub left: Box<LVal>,
pub right: Box<Expression>,
}
pub enum MemberExprProp {
Expr(Box<Expression>),
Id(Identifier),
PrivateName(PrivateName),
}
pub struct MemberExpression {
pub base: BaseNode,
pub object: Box<Expression>,
pub property: Box<MemberExprProp>,
pub computed: bool,
pub optional: Option<bool>,
}
pub enum BinaryExprOp {
Addition,
Subtraction,
Division,
Remainder,
Multiplication,
Exponentiation,
And,
Or,
RightShift,
UnsignedRightShift,
LeftShift,
Xor,
Equal,
StrictEqual,
NotEqual,
StrictNotEqual,
In,
Instanceof,
GreaterThan,
LessThan,
GreaterThanOrEqual,
LessThanOrEqual,
}
pub enum BinaryExprLeft {
Expr(Box<Expression>),
Private(PrivateName),
}
pub struct BinaryExpression {
pub base: BaseNode,
pub operator: BinaryExprOp,
pub left: Box<BinaryExprLeft>,
pub right: Box<Expression>,
}
pub struct V8IntrinsicIdentifier {
pub base: BaseNode,
pub name: JsWord,
}
pub enum Callee {
Expr(Box<Expression>),
V8Id(V8IntrinsicIdentifier),
}
pub struct ArgumentPlaceholder {
pub base: BaseNode,
}
pub enum Arg {
Expr(Box<Expression>),
Spread(SpreadElement),
JSXName(JSXNamespacedName),
Placeholder(ArgumentPlaceholder),
}
pub struct CallExpression {
pub base: BaseNode,
pub callee: Box<Callee>,
pub arguments: Vec<Arg>,
pub optional: Option<bool>,
pub type_arguments: Option<TypeParameterInstantiation>,
pub type_parameters: Option<TSTypeParameterInstantiation>,
}
pub struct ConditionalExpression {
pub base: BaseNode,
pub test: Box<Expression>,
pub consequent: Box<Expression>,
pub alternate: Box<Expression>,
}
pub struct FunctionExpression {
pub base: BaseNode,
pub id: Option<Identifier>,
pub params: Vec<Param>,
pub body: BlockStatement,
pub generator: Option<bool>,
pub is_async: Option<bool>,
pub return_type: Option<Box<TypeAnnotOrNoop>>,
pub type_parameters: Option<TypeParamDeclOrNoop>,
}
pub struct NewExpression {
pub base: BaseNode,
pub callee: Callee,
pub arguments: Vec<Arg>,
pub optional: Option<bool>,
pub type_arguments: Option<TypeParameterInstantiation>,
pub type_parameters: Option<TSTypeParameterInstantiation>,
}
pub enum LogicalExprOp {
Or,
And,
Nullish,
}
pub struct LogicalExpression {
pub base: BaseNode,
pub operator: LogicalExprOp,
pub left: Box<Expression>,
pub right: Box<Expression>,
}
pub enum ObjectExprProp {
Method(ObjectMethod),
Prop(ObjectProperty),
Spread(SpreadElement),
}
pub struct ObjectExpression {
pub base: BaseNode,
pub properties: Vec<ObjectExprProp>,
}
pub struct SequenceExpression {
pub base: BaseNode,
pub expressions: Vec<Box<Expression>>,
}
pub struct ParenthesizedExpression {
pub base: BaseNode,
pub expression: Box<Expression>,
}
pub struct ThisExpression {
pub base: BaseNode,
}
pub enum UnaryExprOp {
Void,
Throw,
Delete,
LogicalNot,
Plus,
Negation,
BitwiseNot,
Typeof,
}
pub struct UnaryExpression {
pub base: BaseNode,
pub operator: UnaryExprOp,
pub argument: Box<Expression>,
pub prefix: bool,
}
pub enum UpdateExprOp {
Increment,
Decrement,
}
pub struct UpdateExpression {
pub base: BaseNode,
pub operator: UpdateExprOp,
pub argument: Box<Expression>,
pub prefix: bool,
}
pub enum ArrowFuncExprBody {
Block(BlockStatement),
Expr(Box<Expression>),
}
pub struct ArrowFunctionExpression {
pub base: BaseNode,
pub params: Vec<Param>,
pub body: Box<ArrowFuncExprBody>,
pub is_async: bool,
pub expression: bool,
pub generator: bool,
pub return_type: Option<Box<TypeAnnotOrNoop>>,
pub type_parameters: Option<TypeParamDeclOrNoop>,
}
pub struct ClassExpression {
pub base: BaseNode,
pub id: Option<Identifier>,
pub super_class: Option<Box<Expression>>,
pub body: ClassBody,
pub decorators: Option<Vec<Decorator>>,
pub implements: Option<Vec<ClassImpl>>,
pub mixins: Option<InterfaceExtends>,
pub super_type_parameters: Option<SuperTypeParams>,
pub type_parameters: Option<TypeParamDeclOrNoop>,
}
pub enum TaggedTemplateExprTypeParams {
Flow(TypeParameterDeclaration),
TS(TSTypeParameterInstantiation),
}
pub struct TaggedTemplateExpression {
pub base: BaseNode,
pub tag: Box<Expression>,
pub quasi: TemplateLiteral,
pub type_parameters: Option<TaggedTemplateExprTypeParams>,
}
pub struct YieldExpression {
pub base: BaseNode,
pub argument: Option<Box<Expression>>,
pub delegate: bool,
}
pub struct AwaitExpression {
pub base: BaseNode,
pub argument: Box<Expression>,
}
pub enum OptionalMemberExprProp {
Expr(Box<Expression>),
Id(Identifier),
}
pub struct OptionalMemberExpression {
pub base: BaseNode,
pub object: Box<Expression>,
pub property: OptionalMemberExprProp,
pub computed: bool,
pub optional: bool,
}
pub struct OptionalCallExpression {
pub base: BaseNode,
pub callee: Box<Expression>,
pub arguments: Vec<Arg>,
pub optional: bool,
pub type_arguments: Option<TypeParameterInstantiation>,
pub type_parameters: Option<TSTypeParameterInstantiation>,
}
pub struct TypeCastExpression {
pub base: BaseNode,
pub expression: Box<Expression>,
pub type_annotation: TypeAnnotation,
}
pub struct BindExpression {
pub base: BaseNode,
pub object: Box<Expression>,
pub callee: Box<Expression>,
}
pub struct PipelinePrimaryTopicReference {
pub base: BaseNode,
}
pub struct DoExpression {
pub base: BaseNode,
pub body: BlockStatement,
}
pub enum RecordExprProp {
Prop(ObjectProperty),
Spread(SpreadElement),
}
pub struct RecordExpression {
pub base: BaseNode,
pub properties: Vec<RecordExprProp>,
}
pub enum TupleExprEl {
Expr(Box<Expression>),
Spread(SpreadElement),
}
pub struct TupleExpression {
pub base: BaseNode,
pub elements: Vec<TupleExprEl>,
}
pub struct ModuleExpression {
pub base: BaseNode,
pub body: Program,
}
pub struct Super {
pub base: BaseNode,
}
pub enum Flow {
AnyTypeAnnotation(AnyTypeAnnotation),
ArrayTypeAnnotation(ArrayTypeAnnotation),
BooleanTypeAnnotation(BooleanTypeAnnotation),
BooleanLiteralTypeAnnotation(BooleanLiteralTypeAnnotation),
NullLiteralTypeAnnotation(NullLiteralTypeAnnotation),
ClassImplements(ClassImplements),
DeclareClass(DeclareClass),
DeclareFunction(DeclareFunction),
DeclareInterface(DeclareInterface),
DeclareModule(DeclareModule),
DeclareModuleExports(DeclareModuleExports),
DeclareTypeAlias(DeclareTypeAlias),
DeclareOpaqueType(DeclareOpaqueType),
DeclareVariable(DeclareVariable),
DeclareExportDeclaration(DeclareExportDeclaration),
DeclareExportAllDeclaration(DeclareExportAllDeclaration),
DeclaredPredicate(DeclaredPredicate),
ExistsTypeAnnotation(ExistsTypeAnnotation),
FunctionTypeAnnotation(FunctionTypeAnnotation),
FunctionTypeParam(FunctionTypeParam),
GenericTypeAnnotation(GenericTypeAnnotation),
InferredPredicate(InferredPredicate),
InterfaceExtends(InterfaceExtends),
InterfaceDeclaration(InterfaceDeclaration),
InterfaceTypeAnnotation(InterfaceTypeAnnotation),
IntersectionTypeAnnotation(IntersectionTypeAnnotation),
MixedTypeAnnotation(MixedTypeAnnotation),
EmptyTypeAnnotation(EmptyTypeAnnotation),
NullableTypeAnnotation(NullableTypeAnnotation),
NumberLiteralTypeAnnotation(NumberLiteralTypeAnnotation),
NumberTypeAnnotation(NumberTypeAnnotation),
ObjectTypeAnnotation(ObjectTypeAnnotation),
ObjectTypeInternalSlot(ObjectTypeInternalSlot),
ObjectTypeCallProperty(ObjectTypeCallProperty),
ObjectTypeIndexer(ObjectTypeIndexer),
ObjectTypeProperty(ObjectTypeProperty),
ObjectTypeSpreadProperty(ObjectTypeSpreadProperty),
OpaqueType(OpaqueType),
QualifiedTypeIdentifier(QualifiedTypeIdentifier),
StringLiteralTypeAnnotation(StringLiteralTypeAnnotation),
StringTypeAnnotation(StringTypeAnnotation),
SymbolTypeAnnotation(SymbolTypeAnnotation),
ThisTypeAnnotation(ThisTypeAnnotation),
TupleTypeAnnotation(TupleTypeAnnotation),
TypeofTypeAnnotation(TypeofTypeAnnotation),
TypeAlias(TypeAlias),
TypeAnnotation(TypeAnnotation),
TypeCastExpression(TypeCastExpression),
TypeParameter(TypeParameter),
TypeParameterDeclaration(TypeParameterDeclaration),
TypeParameterInstantiation(TypeParameterInstantiation),
UnionTypeAnnotation(UnionTypeAnnotation),
Variance(Variance),
VoidTypeAnnotation(VoidTypeAnnotation),
}
pub enum FlowType {
Any(AnyTypeAnnotation),
Array(ArrayTypeAnnotation),
Boolean(BooleanTypeAnnotation),
BooleanLiteral(BooleanLiteralTypeAnnotation),
NullLiteral(NullLiteralTypeAnnotation),
Exists(ExistsTypeAnnotation),
Function(FunctionTypeAnnotation),
Generic(GenericTypeAnnotation),
Interface(InterfaceTypeAnnotation),
Intersection(IntersectionTypeAnnotation),
Mixed(MixedTypeAnnotation),
Empty(EmptyTypeAnnotation),
Nullable(NullableTypeAnnotation),
NumerLiteral(NumberLiteralTypeAnnotation),
Number(NumberTypeAnnotation),
Object(ObjectTypeAnnotation),
StringLiteral(StringLiteralTypeAnnotation),
String(StringTypeAnnotation),
Symbol(SymbolTypeAnnotation),
This(ThisTypeAnnotation),
Tuple(TupleTypeAnnotation),
Typeof(TypeofTypeAnnotation),
Union(UnionTypeAnnotation),
Void(VoidTypeAnnotation),
}
pub enum FlowBaseAnnotation {
Any(AnyTypeAnnotation),
Boolean(BooleanTypeAnnotation),
NullLiteral(NullLiteralTypeAnnotation),
Mixed(MixedTypeAnnotation),
Empty(EmptyTypeAnnotation),
Number(NumberTypeAnnotation),
String(StringTypeAnnotation),
Symbol(SymbolTypeAnnotation),
This(ThisTypeAnnotation),
Void(VoidTypeAnnotation),
}
pub enum FlowDeclaration {
Class(DeclareClass),
Func(DeclareFunction),
Interface(DeclareInterface),
Module(DeclareModule),
ModuleExports(DeclareModuleExports),
DeclareTypeAlias(DeclareTypeAlias),
DeclareOpaqueType(DeclareOpaqueType),
Var(DeclareVariable),
ExportDecl(DeclareExportDeclaration),
ExportAllDecl(DeclareExportAllDeclaration),
InterfaceDeclaration(InterfaceDeclaration),
OpaqueType(OpaqueType),
TypeAlias(TypeAlias),
}
pub enum FlowPredicate {
DeclaredPredicate(DeclaredPredicate),
InferredPredicate(InferredPredicate),
}
pub struct TypeAnnotation {
pub base: BaseNode,
pub type_annotation: FlowType,
}
pub struct AnyTypeAnnotation {
pub base: BaseNode,
}
pub struct ArrayTypeAnnotation {
pub base: BaseNode,
pub element_type: Box<FlowType>,
}
pub struct BooleanTypeAnnotation {
pub base: BaseNode,
}
pub struct BooleanLiteralTypeAnnotation {
pub base: BaseNode,
pub value: bool,
}
pub struct NullLiteralTypeAnnotation {
pub base: BaseNode,
}
pub struct ExistsTypeAnnotation {
pub base: BaseNode,
}
pub struct FunctionTypeParam {
pub base: BaseNode,
pub name: Option<Identifier>,
pub type_annotation: Box<FlowType>,
pub optional: Option<bool>,
}
pub struct FunctionTypeAnnotation {
pub base: BaseNode,
pub type_parameters: Option<TypeParameterDeclaration>,
pub params: Vec<FunctionTypeParam>,
pub rest: Option<Box<FunctionTypeParam>>,
pub return_type: Box<FlowType>,
pub optional: Option<bool>,
}
pub struct TypeParameterDeclaration {
pub base: BaseNode,
pub params: Vec<TypeParameter>,
}
pub enum PlusOrMinus {
Plus,
Minus,
}
pub struct Variance {
pub base: BaseNode,
pub kind: PlusOrMinus,
}
pub struct TypeParameter {
pub base: BaseNode,
pub bound: Option<TypeAnnotation>,
pub default: Option<FlowType>,
pub variance: Option<Variance>,
pub name: JsWord,
}
pub struct TypeParameterInstantiation {
pub base: BaseNode,
pub params: Vec<FlowType>,
}
pub struct GenericTypeAnnotation {
pub base: BaseNode,
pub id: IdOrQualifiedId,
pub type_parameters: Option<TypeParameterInstantiation>,
}
pub struct InterfaceExtends {
pub base: BaseNode,
pub id: IdOrQualifiedId,
pub type_parameters: Option<TypeParameterInstantiation>,
}
pub enum ObjectTypePropKind {
Init,
Get,
Set,
}
pub struct ObjectTypeProperty {
pub base: BaseNode,
pub key: IdOrString,
pub value: FlowType,
pub variance: Option<Variance>,
pub kind: ObjectTypePropKind,
pub method: bool,
pub optional: bool,
pub proto: bool,
pub is_static: bool,
}
pub struct ObjectTypeSpreadProperty {
pub base: BaseNode,
pub argument: FlowType,
}
pub enum ObjectTypeAnnotProp {
Prop(ObjectTypeProperty),
Spread(ObjectTypeSpreadProperty),
}
pub struct ObjectTypeIndexer {
pub base: BaseNode,
pub id: Option<Identifier>,
pub key: FlowType,
pub value: FlowType,
pub variance: Option<Variance>,
pub is_static: bool,
}
pub struct ObjectTypeCallProperty {
pub base: BaseNode,
pub value: FlowType,
pub is_static: bool,
}
pub struct ObjectTypeInternalSlot {
pub base: BaseNode,
pub id: Identifier,
pub value: FlowType,
pub optional: bool,
pub is_static: bool,
pub method: bool,
}
pub struct ObjectTypeAnnotation {
pub base: BaseNode,
pub properties: Vec<ObjectTypeAnnotProp>,
pub indexers: Option<Vec<ObjectTypeIndexer>>,
pub call_properties: Option<Vec<ObjectTypeCallProperty>>,
pub internal_slots: Option<Vec<ObjectTypeInternalSlot>>,
pub exact: bool,
pub inexact: Option<bool>,
}
pub struct InterfaceTypeAnnotation {
pub base: BaseNode,
pub extends: Option<Vec<InterfaceExtends>>,
pub body: ObjectTypeAnnotation,
}
pub struct IntersectionTypeAnnotation {
pub base: BaseNode,
pub types: Vec<FlowType>,
}
pub struct MixedTypeAnnotation {
pub base: BaseNode,
}
pub struct EmptyTypeAnnotation {
pub base: BaseNode,
}
pub struct NullableTypeAnnotation {
pub base: BaseNode,
pub type_annotation: Box<FlowType>,
}
pub struct NumberLiteralTypeAnnotation {
pub base: BaseNode,
pub value: f64,
}
pub struct NumberTypeAnnotation {
pub base: BaseNode,
}
pub struct StringLiteralTypeAnnotation {
pub base: BaseNode,
pub value: JsWord,
}
pub struct StringTypeAnnotation {
pub base: BaseNode,
}
pub struct SymbolTypeAnnotation {
pub base: BaseNode,
}
pub struct ThisTypeAnnotation {
pub base: BaseNode,
}
pub struct TupleTypeAnnotation {
pub base: BaseNode,
pub types: Vec<FlowType>,
}
pub struct TypeofTypeAnnotation {
pub base: BaseNode,
pub argument: Box<FlowType>,
}
pub struct UnionTypeAnnotation {
pub base: BaseNode,
pub types: Vec<FlowType>,
}
pub struct VoidTypeAnnotation {
pub base: BaseNode,
}
pub struct OpaqueType {
pub base: BaseNode,
pub id: Identifier,
pub type_parameters: Option<TypeParameterDeclaration>,
pub supertype: Option<FlowType>,
pub impltype: FlowType,
}
pub struct DeclareOpaqueType {
pub base: BaseNode,
pub id: Identifier,
pub type_parameters: Option<TypeParameterDeclaration>,
pub supertype: Option<FlowType>,
}
pub struct TypeAlias {
pub base: BaseNode,
pub id: Identifier,
pub type_parameters: Option<TypeParameterDeclaration>,
pub right: FlowType,
}
pub struct ClassImplements {
pub base: BaseNode,
pub id: Identifier,
pub type_parameters: Option<TypeParameterInstantiation>,
}
pub struct DeclareClass {
pub base: BaseNode,
pub id: Identifier,
pub type_parameters: Option<TypeParameterInstantiation>,
pub extends: Option<Vec<InterfaceExtends>>,
pub body: ObjectTypeAnnotation,
pub implements: Option<Vec<ClassImplements>>,
pub mixins: Option<Vec<InterfaceExtends>>,
}
pub struct DeclareFunction {
pub base: BaseNode,
pub id: Identifier,
pub predicate: Option<Box<DeclaredPredicate>>,
}
pub struct DeclareInterface {
pub base: BaseNode,
pub id: Identifier,
pub type_parameters: Option<TypeParameterInstantiation>,
pub extends: Option<Vec<InterfaceExtends>>,
pub body: ObjectTypeAnnotation,
pub implements: Option<Vec<ClassImplements>>,
pub mixins: Option<Vec<InterfaceExtends>>,
}
pub enum ModuleKind {
CommonJs,
Es,
}
pub struct DeclareModule {
pub base: BaseNode,
pub id: IdOrString,
pub body: BlockStatement,
pub kind: Option<ModuleKind>,
}
pub struct DeclareModuleExports {
pub base: BaseNode,
pub type_annotation: TypeAnnotation,
}
pub struct DeclareTypeAlias {
pub base: BaseNode,
pub id: Identifier,
pub type_parameters: Option<TypeParameterDeclaration>,
pub right: FlowType,
}
pub struct DeclareVariable {
pub base: BaseNode,
pub id: Identifier,
}
pub enum DeclareExportDeclSpecifier {
Export(ExportSpecifier),
Namespace(ExportNamespaceSpecifier),
}
pub struct DeclareExportDeclaration {
pub base: BaseNode,
pub declaration: Option<Box<Flow>>,
pub specifiers: Option<Vec<DeclareExportDeclSpecifier>>,
pub source: Option<StringLiteral>,
pub default: Option<bool>,
}
pub struct DeclareExportAllDeclaration {
pub base: BaseNode,
pub source: StringLiteral,
pub export_kind: Option<ExportKind>,
}
pub struct DeclaredPredicate {
pub base: BaseNode,
pub value: Box<Flow>,
}
pub struct InferredPredicate {
pub base: BaseNode,
}
pub struct InterfaceDeclaration {
pub base: BaseNode,
pub id: Identifier,
pub type_parameters: Option<TypeParameterDeclaration>,
pub extends: Option<Vec<InterfaceExtends>>,
pub body: ObjectTypeAnnotation,
pub implements: Option<Vec<ClassImplements>>,
pub mixins: Option<Vec<InterfaceExtends>>,
}
pub struct QualifiedTypeIdentifier {
pub base: BaseNode,
pub id: Identifier,
pub qualification: Box<IdOrQualifiedId>,
}
pub enum JSX {
Attr(JSXAttribute),
ClosingEl(JSXClosingElement),
El(JSXElement),
EmptyExpr(JSXEmptyExpression),
ExprContainer(JSXExpressionContainer),
SpreadChild(JSXSpreadChild),
Id(JSXIdentifier),
MemberExpr(JSXMemberExpression),
NamespacedName(JSXNamespacedName),
OpeningEl(JSXOpeningElement),
SpreadAttr(JSXSpreadAttribute),
Text(JSXText),
Fragment(JSXFragment),
OpeningFragment(JSXOpeningFragment),
ClosingFragment(JSXClosingFragment),
}
pub enum JSXAttrName {
Id(JSXIdentifier),
Name(JSXNamespacedName),
}
pub enum JSXAttrVal {
Element(JSXElement),
Fragment(JSXFragment),
String(StringLiteral),
Expr(JSXExpressionContainer),
}
pub struct JSXAttribute {
pub base: BaseNode,
pub name: JSXAttrName,
pub value: Option<JSXAttrVal>,
}
pub struct JSXClosingElement {
pub base: BaseNode,
pub name: JSXElementName,
}
pub struct JSXElement {
pub base: BaseNode,
pub opening_element: JSXOpeningElement,
pub closing_element: Option<JSXClosingElement>,
pub children: Vec<JSXElementChild>,
pub self_closing: Option<bool>,
}
pub struct JSXEmptyExpression {
pub base: BaseNode,
}
pub enum JSXExprContainerExpr {
Expr(Box<Expression>),
Empty(JSXEmptyExpression),
}
pub struct JSXExpressionContainer {
pub base: BaseNode,
pub expression: JSXExprContainerExpr,
}
pub struct JSXSpreadChild {
pub base: BaseNode,
pub expression: Box<Expression>,
}
pub struct JSXIdentifier {
pub base: BaseNode,
pub name: JsWord,
}
pub enum JSXMemberExprObject {
Expr(JSXMemberExpression),
Id(JSXIdentifier),
}
pub struct JSXMemberExpression {
pub base: BaseNode,
pub object: Box<JSXMemberExprObject>,
pub property: JSXIdentifier,
}
pub struct JSXNamespacedName {
pub base: BaseNode,
pub namespace: JSXIdentifier,
pub name: JSXIdentifier,
}
pub enum JSXOpeningElAttr {
Attr(JSXAttribute),
Spread(JSXSpreadAttribute),
}
pub struct JSXOpeningElement {
pub base: BaseNode,
pub name: JSXElementName,
pub attributes: Vec<JSXOpeningElAttr>,
pub self_closing: bool,
pub type_parameters: Option<SuperTypeParams>,
}
pub struct JSXSpreadAttribute {
pub base: BaseNode,
pub argument: Box<Expression>,
}
pub struct JSXText {
pub base: BaseNode,
pub value: JsWord,
}
pub struct JSXFragment {
pub base: BaseNode,
pub opening_fragment: JSXOpeningFragment,
pub closing_fragment: JSXClosingFragment,
pub children: Vec<JSXElementChild>,
}
pub struct JSXOpeningFragment {
pub base: BaseNode,
}
pub struct JSXClosingFragment {
pub base: BaseNode,
}
pub enum JSXElementName {
Id(JSXIdentifier),
Expr(JSXMemberExpression),
Name(JSXNamespacedName),
}
pub enum JSXElementChild {
Text(JSXText),
Expr(JSXExpressionContainer),
Spread(JSXSpreadChild),
Element(JSXElement),
Fragment(JSXFragment),
}
pub enum Literal {
String(StringLiteral),
Numeric(NumericLiteral),
Null(NullLiteral),
Boolean(BooleanLiteral),
RegExp(RegExpLiteral),
Template(TemplateLiteral),
BigInt(BigIntLiteral),
Decimal(DecimalLiteral),
}
pub struct StringLiteral {
pub base: BaseNode,
pub value: JsWord,
}
pub struct NumericLiteral {
pub base: BaseNode,
pub value: f64,
}
pub struct NumberLiteral {
pub base: BaseNode,
pub value: f64,
}
pub struct NullLiteral {
pub base: BaseNode,
}
pub struct BooleanLiteral {
pub base: BaseNode,
pub value: bool,
}
pub struct RegExpLiteral {
pub base: BaseNode,
pub pattern: JsWord,
pub flags: JsWord,
}
pub struct RegexLiteral {
pub base: BaseNode,
pub pattern: JsWord,
pub flags: JsWord,
}
pub struct TemplateElVal {
pub raw: JsWord,
pub cooked: Option<JsWord>,
}
pub struct TemplateElement {
pub base: BaseNode,
pub value: TemplateElVal,
pub tail: bool,
}
pub enum TemplateLiteralExpr {
Expr(Box<Expression>),
TSType(TSType),
}
pub struct TemplateLiteral {
pub base: BaseNode,
pub quasis: Vec<TemplateElement>,
pub expressions: Vec<TemplateLiteralExpr>,
}
pub struct BigIntLiteral {
pub base: BaseNode,
pub value: String,
}
pub struct DecimalLiteral {
pub base: BaseNode,
pub value: JsWord,
}
pub enum ModuleDeclaration {
ExportAll(ExportAllDeclaration),
ExportDefault(ExportDefaultDeclaration),
ExportNamed(ExportNamedDeclaration),
Import(ImportDeclaration),
}
pub enum ExportDeclaration {
ExportAll(ExportAllDeclaration),
ExportDefault(ExportDefaultDeclaration),
ExportNamed(ExportNamedDeclaration),
}
pub enum ModuleSpecifier {
Export(ExportSpecifier),
ImportDefault(ImportDefaultSpecifier),
ImportNamespace(ImportNamespaceSpecifier),
Import(ImportSpecifier),
ExportNamespace(ExportNamespaceSpecifier),
ExportDefault(ExportDefaultSpecifier),
}
pub struct File {
pub base: BaseNode,
pub program: Program,
pub comments: Option<Vec<Comment>>,
pub tokens: Option<Vec<Value>>,
}
pub struct InterpreterDirective {
pub base: BaseNode,
pub value: JsWord,
}
pub enum SrcType {
Script,
Module,
}
pub struct Program {
pub base: BaseNode,
pub body: Vec<Statement>,
pub directives: Vec<Directive>,
pub source_type: SrcType,
pub interpreter: Option<InterpreterDirective>,
pub source_file: String,
}
pub enum ExportKind {
Type,
Value,
}
pub struct ExportSpecifier {
pub base: BaseNode,
pub local: Identifier,
pub exported: IdOrString,
pub export_kind: ExportKind,
}
pub struct ExportDefaultSpecifier {
pub base: BaseNode,
pub exported: Identifier,
}
pub struct ExportNamespaceSpecifier {
pub base: BaseNode,
pub exported: Identifier,
}
pub struct ExportAllDeclaration {
pub base: BaseNode,
pub source: StringLiteral,
pub assertions: Option<Vec<ImportAttribute>>,
pub export_kind: Option<ExportKind>,
}
pub enum ExportDefaultDeclType {
Func(FunctionDeclaration),
TSFunc(TSDeclareFunction),
Class(ClassDeclaration),
Expr(Box<Expression>),
}
pub struct ExportDefaultDeclaration {
pub base: BaseNode,
pub declaration: ExportDefaultDeclType,
}
pub enum ExportSpecifierType {
Export(ExportSpecifier),
Default(ExportDefaultSpecifier),
Namespace(ExportNamespaceSpecifier),
}
pub struct ExportNamedDeclaration {
pub base: BaseNode,
pub declaration: Option<Box<Declaration>>,
pub specifiers: Vec<ExportSpecifierType>,
pub source: Option<StringLiteral>,
pub assertions: Option<Vec<ImportAttribute>>,
pub export_kind: Option<ExportKind>,
}
pub struct Import {
pub base: BaseNode,
}
pub struct ImportAttribute {
pub base: BaseNode,
pub key: IdOrString,
pub value: StringLiteral,
}
pub struct ImportSpecifier {
pub base: BaseNode,
pub local: Identifier,
pub imported: IdOrString,
pub import_kind: Option<ImportKind>,
}
pub struct ImportDefaultSpecifier {
pub base: BaseNode,
pub local: Identifier,
}
pub struct ImportNamespaceSpecifier {
pub base: BaseNode,
pub local: Identifier,
}
pub enum ImportSpecifierType {
Import(ImportSpecifier),
Default(ImportDefaultSpecifier),
Namespace(ImportNamespaceSpecifier),
}
pub enum ImportKind {
Type,
Typeof,
Value,
}
pub struct ImportDeclaration {
pub base: BaseNode,
pub specifiers: Vec<ImportSpecifierType>,
pub source: StringLiteral,
pub assertions: Option<Vec<ImportAttribute>>,
pub import_kind: Option<ImportKind>,
}
pub enum UserWhitespacable {
ObjectMethod(ObjectMethod),
ObjectProperty(ObjectProperty),
ObjectTypeInternalSlot(ObjectTypeInternalSlot),
ObjectTypeCallProperty(ObjectTypeCallProperty),
ObjectTypeIndexer(ObjectTypeIndexer),
ObjectTypeProperty(ObjectTypeProperty),
ObjectTypeSpreadProperty(ObjectTypeSpreadProperty),
}
pub enum ObjectMember {
Method(ObjectMethod),
Prop(ObjectProperty),
}
pub enum ObjectMethodKind {
Method,
Get,
Set,
}
pub enum ObjectKey {
Expr(Box<Expression>),
Id(Identifier),
String(StringLiteral),
Numeric(NumericLiteral),
}
pub struct ObjectMethod {
pub base: BaseNode,
pub kind: ObjectMethodKind,
pub key: ObjectKey,
pub params: Vec<Param>,
pub body: BlockStatement,
pub computed: bool,
pub generator: Option<bool>,
pub is_async: Option<bool>,
pub decorator: Option<Vec<Decorator>>,
pub return_type: Option<Box<TypeAnnotOrNoop>>,
pub type_parameters: Option<TypeParamDeclOrNoop>,
}
pub enum ObjectPropVal {
Expr(Box<Expression>),
Pattern(PatternLike),
}
pub struct ObjectProperty {
pub base: BaseNode,
pub key: ObjectKey,
pub value: ObjectPropVal,
pub computed: bool,
pub shorthand: bool,
pub decorators: Option<Vec<Decorator>>,
}
pub enum Pattern {
Assignment(AssignmentPattern),
Array(ArrayPattern),
Object(ObjectPattern),
}
pub enum ObjectPatternProp {
Rest(RestElement),
Prop(ObjectProperty),
}
pub struct ObjectPattern {
pub base: BaseNode,
pub properties: Vec<ObjectPatternProp>,
pub decorators: Option<Vec<Decorator>>,
pub type_annotation: Option<Box<TypeAnnotOrNoop>>,
}
pub enum AssignmentPatternLeft {
Id(Identifier),
Object(ObjectPattern),
Array(ArrayPattern),
Member(MemberExpression),
}
pub struct AssignmentPattern {
pub base: BaseNode,
pub left: AssignmentPatternLeft,
pub right: Box<Expression>,
pub decorators: Option<Vec<Decorator>>,
pub type_annotation: Option<Box<TypeAnnotOrNoop>>,
}
pub struct ArrayPattern {
pub base: BaseNode,
pub elements: Vec<Option<PatternLike>>,
pub decorators: Option<Vec<Decorator>>,
pub type_annotation: Option<Box<TypeAnnotOrNoop>>,
}
pub enum Statement {
Block(BlockStatement),
Break(BreakStatement),
Continue(ContinueStatement),
Debugger(DebuggerStatement),
DoWhile(DoWhileStatement),
Empty(EmptyStatement),
Expr(ExpressionStatement),
ForIn(ForInStatement),
For(ForStatement),
FuncDecl(FunctionDeclaration),
If(IfStatement),
Labeled(LabeledStatement),
Return(ReturnStatement),
Switch(SwitchStatement),
Throw(ThrowStatement),
Try(TryStatement),
VarDecl(VariableDeclaration),
While(WhileStatement),
With(WithStatement),
ClassDecl(ClassDeclaration),
ExportAllDecl(ExportAllDeclaration),
ExportDefaultDecl(ExportDefaultDeclaration),
ExportNamedDecl(ExportNamedDeclaration),
ForOf(ForOfStatement),
ImportDecl(ImportDeclaration),
DeclClass(DeclareClass),
DeclFunc(DeclareFunction),
DeclInterface(DeclareInterface),
DeclModule(DeclareModule),
DeclareModuleExports(DeclareModuleExports),
DeclTypeAlias(DeclareTypeAlias),
DeclOpaqueType(DeclareOpaqueType),
DeclVar(DeclareVariable),
DeclExportDeclaration(DeclareExportDeclaration),
DeclExportAllDeclaration(DeclareExportAllDeclaration),
InterfaceDecl(InterfaceDeclaration),
OpaqueType(OpaqueType),
TypeAlias(TypeAlias),
EnumDecl(EnumDeclaration),
TSDeclFunc(TSDeclareFunction),
TSInterfaceDecl(TSInterfaceDeclaration),
TSTypeAliasDecl(TSTypeAliasDeclaration),
TSEnumDecl(TSEnumDeclaration),
TSModuleDecl(TSModuleDeclaration),
TSImportEqualsDecl(TSImportEqualsDeclaration),
TSExportAssignment(TSExportAssignment),
TSNamespaceExportDecl(TSNamespaceExportDeclaration),
}
pub enum CompletionStatement {
Break(BreakStatement),
Continue(ContinueStatement),
Return(ReturnStatement),
Throw(ThrowStatement),
}
pub enum Loop {
DoWhile(DoWhileStatement),
ForIn(ForInStatement),
For(ForStatement),
While(WhileStatement),
ForOf(ForOfStatement),
}
pub enum For {
InStmt(ForInStatement),
Stmt(ForStatement),
OfStmt(ForOfStatement),
}
pub enum ForXStatement {
ForIn(ForInStatement),
ForOf(ForOfStatement),
}
pub enum While {
DoWhile(DoWhileStatement),
While(WhileStatement),
}
pub struct BlockStatement {
pub base: BaseNode,
pub body: Vec<Statement>,
pub directives: Vec<Directive>,
}
pub struct BreakStatement {
pub base: BaseNode,
pub label: Option<Identifier>,
}
pub struct ContinueStatement {
pub base: BaseNode,
pub label: Option<Identifier>,
}
pub struct DebuggerStatement {
pub base: BaseNode,
}
pub struct DoWhileStatement {
pub base: BaseNode,
pub test: Box<Expression>,
pub body: Box<Statement>,
}
pub struct EmptyStatement {
pub base: BaseNode,
}
pub struct ExpressionStatement {
pub base: BaseNode,
pub expression: Box<Expression>,
}
pub enum ForStmtInit {
VarDecl(VariableDeclaration),
Expr(Box<Expression>),
}
pub enum ForStmtLeft {
VarDecl(VariableDeclaration),
LVal(LVal),
}
pub struct ForInStatement {
pub base: BaseNode,
pub left: ForStmtLeft,
pub right: Box<Expression>,
pub body: Box<Statement>,
}
pub struct ForStatement {
pub base: BaseNode,
pub init: Option<ForStmtInit>,
pub test: Option<Box<Expression>>,
pub update: Option<Box<Expression>>,
pub body: Box<Statement>,
}
pub struct ForOfStatement {
pub base: BaseNode,
pub left: ForStmtLeft,
pub right: Box<Expression>,
pub body: Box<Statement>,
}
pub struct IfStatement {
pub base: BaseNode,
pub test: Box<Expression>,
pub consequent: Box<Statement>,
pub alternate: Option<Box<Statement>>,
}
pub struct LabeledStatement {
pub base: BaseNode,
pub label: Identifier,
pub body: Box<Statement>,
}
pub struct ReturnStatement {
pub base: BaseNode,
pub argument: Option<Box<Expression>>,
}
pub struct SwitchCase {
pub base: BaseNode,
pub test: Option<Box<Expression>>,
pub consequent: Vec<Statement>,
}
pub struct SwitchStatement {
pub base: BaseNode,
pub discriminant: Box<Expression>,
pub cases: Vec<SwitchCase>,
}
pub struct ThrowStatement {
pub base: BaseNode,
pub argument: Box<Expression>,
}
pub enum CatchClauseParam {
Id(Identifier),
Array(ArrayPattern),
Object(ObjectPattern),
}
pub struct CatchClause {
pub base: BaseNode,
pub param: Option<CatchClauseParam>,
pub body: BlockStatement,
}
pub struct TryStatement {
pub base: BaseNode,
pub block: BlockStatement,
pub handler: Option<CatchClause>,
pub finalizer: Option<BlockStatement>,
}
pub struct WhileStatement {
pub base: BaseNode,
pub test: Box<Expression>,
pub body: Box<Statement>,
}
pub struct WithStatement {
pub base: BaseNode,
pub object: Box<Expression>,
pub body: Box<Statement>,
}
pub enum TSTypeElement {
CallSignatureDecl(TSCallSignatureDeclaration),
ConstructSignatureDecl(TSConstructSignatureDeclaration),
PropSignature(TSPropertySignature),
MethodSignature(TSMethodSignature),
IndexSignature(TSIndexSignature),
}
pub enum TSType {
AnyKeyword(TSAnyKeyword),
BooleanKeyword(TSBooleanKeyword),
BigIntKeyword(TSBigIntKeyword),
IntrinsicKeyword(TSIntrinsicKeyword),
NeverKeyword(TSNeverKeyword),
NullKeyword(TSNullKeyword),
NumberKeyword(TSNumberKeyword),
ObjectKeyword(TSObjectKeyword),
StringKeyword(TSStringKeyword),
SymbolKeyword(TSSymbolKeyword),
UndefinedKeyword(TSUndefinedKeyword),
UnknownKeyword(TSUnknownKeyword),
VoidKeyword(TSVoidKeyword),
This(TSThisType),
Function(TSFunctionType),
Constructor(TSConstructorType),
TypeRef(TSTypeReference),
TypePredicate(TSTypePredicate),
TypeQuery(TSTypeQuery),
TypeLiteral(TSTypeLiteral),
Array(TSArrayType),
Tuple(TSTupleType),
Optional(TSOptionalType),
Rest(TSRestType),
Union(TSUnionType),
Intersection(TSIntersectionType),
Conditional(TSConditionalType),
Infer(TSInferType),
Parenthesized(TSParenthesizedType),
TypeOp(TSTypeOperator),
IndexedAccess(TSIndexedAccessType),
Mapped(TSMappedType),
Literal(TSLiteralType),
ExprWithArgs(TSExpressionWithTypeArguments),
Import(TSImportType),
}
pub enum TSBaseType {
Any(TSAnyKeyword),
Boolean(TSBooleanKeyword),
BigInt(TSBigIntKeyword),
Intrinsic(TSIntrinsicKeyword),
Never(TSNeverKeyword),
Null(TSNullKeyword),
Number(TSNumberKeyword),
Object(TSObjectKeyword),
String(TSStringKeyword),
Symbol(TSSymbolKeyword),
Undefined(TSUndefinedKeyword),
Unknown(TSUnknownKeyword),
Void(TSVoidKeyword),
This(TSThisType),
Literal(TSLiteralType),
}
pub struct TSTypeAnnotation {
pub base: BaseNode,
pub type_annotation: TSType,
}
pub enum TSParamPropParam {
Id(Identifier),
Assignment(AssignmentPattern),
}
pub struct TSParameterProperty {
pub base: BaseNode,
pub parameter: TSParamPropParam,
pub accessibility: Option<Access>,
pub readonly: Option<bool>,
}
pub enum TSFuncDeclTypeParams {
Type(TSTypeParameterDeclaration),
Noop(Noop),
}
pub enum TSFuncDeclTypeAnnot {
Type(Box<TSTypeAnnotation>),
Noop(Noop),
}
pub struct TSDeclareFunction {
pub base: BaseNode,
pub id: Option<Identifier>,
pub type_parameters: Option<TSFuncDeclTypeParams>,
pub params: Vec<Param>,
pub return_type: Option<TSFuncDeclTypeAnnot>,
pub is_async: Option<bool>,
pub declare: Option<bool>,
pub generator: Option<bool>,
}
pub struct TSDeclareMethod {
pub base: BaseNode,
pub decorators: Option<Vec<Decorator>>,
pub key: ObjectKey,
pub type_parameters: Option<TSFuncDeclTypeParams>,
pub params: Vec<Param>,
pub return_type: Option<TSFuncDeclTypeAnnot>,
pub is_abstract: Option<bool>,
pub access: Option<Access>,
pub accessibility: Option<Access>,
pub is_async: Option<bool>,
pub computed: Option<bool>,
pub generator: Option<bool>,
pub kind: Option<ClassMethodKind>,
pub optional: Option<bool>,
pub is_static: Option<bool>,
}
pub struct TSQualifiedName {
pub base: BaseNode,
pub left: Box<TSEntityName>,
pub right: Identifier,
}
pub struct TSCallSignatureDeclaration {
pub base: BaseNode,
pub type_parameters: Option<TSTypeParameterDeclaration>,
pub parameters: Vec<IdOrRest>,
pub type_annotation: Option<Box<TSTypeAnnotation>>,
}
pub struct TSConstructSignatureDeclaration {
pub base: BaseNode,
pub type_parameters: Option<TSTypeParameterDeclaration>,
pub parameters: Vec<IdOrRest>,
pub type_annotation: Option<Box<TSTypeAnnotation>>,
}
pub struct TSPropertySignature {
pub base: BaseNode,
pub key: Box<Expression>,
pub type_annotation: Option<Box<TSTypeAnnotation>>,
pub initializer: Option<Box<Expression>>,
pub computed: Option<bool>,
pub optional: Option<bool>,
pub readonly: Option<bool>,
}
pub struct TSMethodSignature {
pub base: BaseNode,
pub key: Box<Expression>,
pub type_parameters: Option<TSTypeParameterDeclaration>,
pub parameters: Vec<IdOrRest>,
pub type_annotation: Option<Box<TSTypeAnnotation>>,
pub computed: Option<bool>,
pub optional: Option<bool>,
}
pub struct TSIndexSignature {
pub base: BaseNode,
pub paramters: Vec<Identifier>,
pub type_annotation: Option<Box<TSTypeAnnotation>>,
pub readonly: Option<bool>,
}
pub struct TSAnyKeyword {
pub base: BaseNode,
}
pub struct TSBooleanKeyword {
pub base: BaseNode,
}
pub struct TSBigIntKeyword {
pub base: BaseNode,
}
pub struct TSIntrinsicKeyword {
pub base: BaseNode,
}
pub struct TSNeverKeyword {
pub base: BaseNode,
}
pub struct TSNullKeyword {
pub base: BaseNode,
}
pub struct TSNumberKeyword {
pub base: BaseNode,
}
pub struct TSObjectKeyword {
pub base: BaseNode,
}
pub struct TSStringKeyword {
pub base: BaseNode,
}
pub struct TSSymbolKeyword {
pub base: BaseNode,
}
pub struct TSUndefinedKeyword {
pub base: BaseNode,
}
pub struct TSUnknownKeyword {
pub base: BaseNode,
}
pub struct TSVoidKeyword {
pub base: BaseNode,
}
pub struct TSThisType {
pub base: BaseNode,
}
pub struct TSFunctionType {
pub base: BaseNode,
pub type_parameters: Option<TSTypeParameterDeclaration>,
pub parameters: Vec<IdOrRest>,
pub type_annotation: Option<Box<TSTypeAnnotation>>,
}
pub struct TSConstructorType {
pub base: BaseNode,
pub type_parameters: Option<TSTypeParameterDeclaration>,
pub parameters: Vec<IdOrRest>,
pub type_annotation: Option<Box<TSTypeAnnotation>>,
pub is_abstract: Option<bool>,
}
pub enum TSEntityName {
Id(Identifier),
Qualified(TSQualifiedName),
}
pub struct TSTypeReference {
pub base: BaseNode,
pub type_name: TSEntityName,
pub type_parameters: Option<TSTypeParameterInstantiation>,
}
pub enum TSTypePredicateParamName {
Id(Identifier),
This(TSThisType),
}
pub struct TSTypePredicate {
pub base: BaseNode,
pub parameter_name: TSTypePredicateParamName,
pub type_annotation: Option<Box<TSTypeAnnotation>>,
pub asserts: Option<bool>,
}
pub enum TSTypeQueryExprName {
EntityName(TSEntityName),
ImportType(TSImportType),
}
pub struct TSTypeQuery {
pub base: BaseNode,
pub expr_name: TSTypeQueryExprName,
}
pub struct TSTypeLiteral {
pub base: BaseNode,
pub members: Vec<TSTypeElement>,
}
pub struct TSArrayType {
pub base: BaseNode,
pub element_type: Box<TSType>,
}
pub enum TSTupleTypeElType {
TSType(TSType),
Member(TSNamedTupleMember),
}
pub struct TSTupleType {
pub base: BaseNode,
pub element_types: Vec<TSTupleTypeElType>,
}
pub struct TSOptionalType {
pub base: BaseNode,
pub type_annotation: Box<TSType>,
}
pub struct TSRestType {
pub base: BaseNode,
pub type_annotation: Box<TSType>,
}
pub struct TSNamedTupleMember {
pub base: BaseNode,
pub label: Identifier,
pub element_type: TSType,
pub optional: bool,
}
pub struct TSUnionType {
pub base: BaseNode,
pub types: Vec<TSType>,
}
pub struct TSIntersectionType {
pub base: BaseNode,
pub types: Vec<TSType>,
}
pub struct TSConditionalType {
pub base: BaseNode,
pub check_type: Box<TSType>,
pub extends_type: Box<TSType>,
pub true_type: Box<TSType>,
pub false_type: Box<TSType>,
}
pub struct TSInferType {
pub base: BaseNode,
pub type_parameter: Box<TSTypeParameter>,
}
pub struct TSParenthesizedType {
pub base: BaseNode,
pub type_annotation: Box<TSType>,
}
pub struct TSTypeOperator {
pub base: BaseNode,
pub type_annotation: Box<TSType>,
pub operator: JsWord,
}
pub struct TSIndexedAccessType {
pub base: BaseNode,
pub object_type: Box<TSType>,
pub index_type: Box<TSType>,
}
pub struct TSMappedType {
pub base: BaseNode,
pub type_parameter: Box<TSTypeParameter>,
pub type_annotation: Option<Box<TSType>>,
pub name_type: Option<Box<TSType>>,
pub optional: Option<bool>,
pub readonly: Option<bool>,
}
pub enum TSLiteralTypeLiteral {
Numeric(NumericLiteral),
String(StringLiteral),
Boolean(BooleanLiteral),
BigInt(BigIntLiteral),
}
pub struct TSLiteralType {
pub base: BaseNode,
pub literal: TSLiteralTypeLiteral,
}
pub struct TSExpressionWithTypeArguments {
pub base: BaseNode,
pub expression: TSEntityName,
pub type_parameters: Option<TSTypeParameterInstantiation>,
}
pub struct TSInterfaceDeclaration {
pub base: BaseNode,
pub id: Identifier,
pub type_parameters: Option<TSTypeParameterDeclaration>,
pub extends: Option<TSExpressionWithTypeArguments>,
pub body: TSInterfaceBody,
pub declare: Option<bool>,
}
pub struct TSInterfaceBody {
pub base: BaseNode,
pub body: Vec<TSTypeElement>,
}
pub struct TSTypeAliasDeclaration {
pub base: BaseNode,
pub id: Identifier,
pub type_parameters: Option<TSTypeParameterDeclaration>,
pub type_annotation: TSType,
pub declare: Option<bool>,
}
pub struct TSAsExpression {
pub base: BaseNode,
pub expression: Box<Expression>,
pub type_annotation: TSType,
}
pub struct TSTypeAssertion {
pub base: BaseNode,
pub type_annotation: TSType,
pub expression: Box<Expression>,
}
pub struct TSEnumDeclaration {
pub base: BaseNode,
pub id: Identifier,
pub members: Vec<TSEnumMember>,
pub is_const: Option<bool>,
pub declare: Option<bool>,
pub initializer: Option<Box<Expression>>,
}
pub struct TSEnumMember {
pub base: BaseNode,
pub id: IdOrString,
pub initializer: Option<Box<Expression>>,
}
pub enum TSModuleDeclBody {
Block(TSModuleBlock),
Decl(TSModuleDeclaration),
}
pub struct TSModuleDeclaration {
pub base: BaseNode,
pub id: IdOrString,
pub body: Box<TSModuleDeclBody>,
pub declare: Option<bool>,
pub global: Option<bool>,
}
pub struct TSModuleBlock {
pub base: BaseNode,
pub body: Vec<Statement>,
}
pub struct TSImportType {
pub base: BaseNode,
pub argument: StringLiteral,
pub qualifier: Option<TSEntityName>,
pub type_parameters: Option<TSTypeParameterInstantiation>,
}
pub enum TSImportEqualsDeclModuleRef {
Name(TSEntityName),
External(TSExternalModuleReference),
}
pub struct TSImportEqualsDeclaration {
pub base: BaseNode,
pub id: Identifier,
pub module_reference: TSImportEqualsDeclModuleRef,
pub is_export: bool,
}
pub struct TSExternalModuleReference {
pub base: BaseNode,
pub expression: StringLiteral,
}
pub struct TSNonNullExpression {
pub base: BaseNode,
pub expression: Box<Expression>,
}
pub struct TSExportAssignment {
pub base: BaseNode,
pub expression: Box<Expression>,
}
pub struct TSNamespaceExportDeclaration {
pub base: BaseNode,
pub id: Identifier,
}
pub struct TSTypeParameterInstantiation {
pub base: BaseNode,
pub params: Vec<TSType>,
}
pub struct TSTypeParameterDeclaration {
pub base: BaseNode,
pub params: Vec<TSTypeParameter>,
}
pub struct TSTypeParameter {
pub base: BaseNode,
pub constraint: Option<Box<TSType>>,
pub default: Option<Box<TSType>>,
pub name: JsWord,
}
});