hermes-estree 0.7.0 → 0.8.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.
@@ -32,12 +32,11 @@ import type {
32
32
  BreakStatement,
33
33
  CallExpression,
34
34
  CatchClause,
35
+ ChainExpression,
35
36
  ClassBody,
36
37
  ClassDeclaration,
37
38
  ClassExpression,
38
39
  ClassImplements,
39
- ClassPrivateProperty,
40
- ClassProperty,
41
40
  ConditionalExpression,
42
41
  ContinueStatement,
43
42
  DebuggerStatement,
@@ -68,7 +67,6 @@ import type {
68
67
  ExportAllDeclaration,
69
68
  ExportDefaultDeclaration,
70
69
  ExportNamedDeclaration,
71
- ExportNamespaceSpecifier,
72
70
  ExportSpecifier,
73
71
  ExpressionStatement,
74
72
  ForInStatement,
@@ -128,12 +126,11 @@ import type {
128
126
  ObjectTypeProperty,
129
127
  ObjectTypeSpreadProperty,
130
128
  OpaqueType,
131
- OptionalCallExpression,
132
129
  OptionalIndexedAccessType,
133
- OptionalMemberExpression,
134
- PrivateName,
130
+ PrivateIdentifier,
135
131
  Program,
136
132
  Property,
133
+ PropertyDefinition,
137
134
  QualifiedTypeIdentifier,
138
135
  RestElement,
139
136
  ReturnStatement,
@@ -276,6 +273,9 @@ interface CatchClause_With_param extends CatchClause {
276
273
  interface CatchClause_With_body extends CatchClause {
277
274
  +body: $NonMaybeType<CatchClause['body']>;
278
275
  }
276
+ interface ChainExpression_With_expression extends ChainExpression {
277
+ +expression: $NonMaybeType<ChainExpression['expression']>;
278
+ }
279
279
  interface ClassBody_With_body extends ClassBody {
280
280
  +body: $NonMaybeType<ClassBody['body']>;
281
281
  }
@@ -327,52 +327,6 @@ interface ClassImplements_With_id extends ClassImplements {
327
327
  interface ClassImplements_With_typeParameters extends ClassImplements {
328
328
  +typeParameters: $NonMaybeType<ClassImplements['typeParameters']>;
329
329
  }
330
- interface ClassPrivateProperty_With_key extends ClassPrivateProperty {
331
- +key: $NonMaybeType<ClassPrivateProperty['key']>;
332
- }
333
- interface ClassPrivateProperty_With_value extends ClassPrivateProperty {
334
- +value: $NonMaybeType<ClassPrivateProperty['value']>;
335
- }
336
- interface ClassPrivateProperty_With_static extends ClassPrivateProperty {
337
- +static: $NonMaybeType<ClassPrivateProperty['static']>;
338
- }
339
- interface ClassPrivateProperty_With_declare extends ClassPrivateProperty {
340
- +declare: $NonMaybeType<ClassPrivateProperty['declare']>;
341
- }
342
- interface ClassPrivateProperty_With_optional extends ClassPrivateProperty {
343
- +optional: $NonMaybeType<ClassPrivateProperty['optional']>;
344
- }
345
- interface ClassPrivateProperty_With_variance extends ClassPrivateProperty {
346
- +variance: $NonMaybeType<ClassPrivateProperty['variance']>;
347
- }
348
- interface ClassPrivateProperty_With_typeAnnotation
349
- extends ClassPrivateProperty {
350
- +typeAnnotation: $NonMaybeType<ClassPrivateProperty['typeAnnotation']>;
351
- }
352
- interface ClassProperty_With_key extends ClassProperty {
353
- +key: $NonMaybeType<ClassProperty['key']>;
354
- }
355
- interface ClassProperty_With_value extends ClassProperty {
356
- +value: $NonMaybeType<ClassProperty['value']>;
357
- }
358
- interface ClassProperty_With_computed extends ClassProperty {
359
- +computed: $NonMaybeType<ClassProperty['computed']>;
360
- }
361
- interface ClassProperty_With_static extends ClassProperty {
362
- +static: $NonMaybeType<ClassProperty['static']>;
363
- }
364
- interface ClassProperty_With_declare extends ClassProperty {
365
- +declare: $NonMaybeType<ClassProperty['declare']>;
366
- }
367
- interface ClassProperty_With_optional extends ClassProperty {
368
- +optional: $NonMaybeType<ClassProperty['optional']>;
369
- }
370
- interface ClassProperty_With_variance extends ClassProperty {
371
- +variance: $NonMaybeType<ClassProperty['variance']>;
372
- }
373
- interface ClassProperty_With_typeAnnotation extends ClassProperty {
374
- +typeAnnotation: $NonMaybeType<ClassProperty['typeAnnotation']>;
375
- }
376
330
  interface ConditionalExpression_With_test extends ConditionalExpression {
377
331
  +test: $NonMaybeType<ConditionalExpression['test']>;
378
332
  }
@@ -547,6 +501,9 @@ interface EnumSymbolBody_With_members extends EnumSymbolBody {
547
501
  interface EnumSymbolBody_With_hasUnknownMembers extends EnumSymbolBody {
548
502
  +hasUnknownMembers: $NonMaybeType<EnumSymbolBody['hasUnknownMembers']>;
549
503
  }
504
+ interface ExportAllDeclaration_With_exported extends ExportAllDeclaration {
505
+ +exported: $NonMaybeType<ExportAllDeclaration['exported']>;
506
+ }
550
507
  interface ExportAllDeclaration_With_source extends ExportAllDeclaration {
551
508
  +source: $NonMaybeType<ExportAllDeclaration['source']>;
552
509
  }
@@ -572,10 +529,6 @@ interface ExportNamedDeclaration_With_exportKind
572
529
  extends ExportNamedDeclaration {
573
530
  +exportKind: $NonMaybeType<ExportNamedDeclaration['exportKind']>;
574
531
  }
575
- interface ExportNamespaceSpecifier_With_exported
576
- extends ExportNamespaceSpecifier {
577
- +exported: $NonMaybeType<ExportNamespaceSpecifier['exported']>;
578
- }
579
532
  interface ExportSpecifier_With_exported extends ExportSpecifier {
580
533
  +exported: $NonMaybeType<ExportSpecifier['exported']>;
581
534
  }
@@ -1031,19 +984,6 @@ interface OpaqueType_With_impltype extends OpaqueType {
1031
984
  interface OpaqueType_With_supertype extends OpaqueType {
1032
985
  +supertype: $NonMaybeType<OpaqueType['supertype']>;
1033
986
  }
1034
- interface OptionalCallExpression_With_callee extends OptionalCallExpression {
1035
- +callee: $NonMaybeType<OptionalCallExpression['callee']>;
1036
- }
1037
- interface OptionalCallExpression_With_typeArguments
1038
- extends OptionalCallExpression {
1039
- +typeArguments: $NonMaybeType<OptionalCallExpression['typeArguments']>;
1040
- }
1041
- interface OptionalCallExpression_With_arguments extends OptionalCallExpression {
1042
- +arguments: $NonMaybeType<OptionalCallExpression['arguments']>;
1043
- }
1044
- interface OptionalCallExpression_With_optional extends OptionalCallExpression {
1045
- +optional: $NonMaybeType<OptionalCallExpression['optional']>;
1046
- }
1047
987
  interface OptionalIndexedAccessType_With_objectType
1048
988
  extends OptionalIndexedAccessType {
1049
989
  +objectType: $NonMaybeType<OptionalIndexedAccessType['objectType']>;
@@ -1056,24 +996,8 @@ interface OptionalIndexedAccessType_With_optional
1056
996
  extends OptionalIndexedAccessType {
1057
997
  +optional: $NonMaybeType<OptionalIndexedAccessType['optional']>;
1058
998
  }
1059
- interface OptionalMemberExpression_With_object
1060
- extends OptionalMemberExpression {
1061
- +object: $NonMaybeType<OptionalMemberExpression['object']>;
1062
- }
1063
- interface OptionalMemberExpression_With_property
1064
- extends OptionalMemberExpression {
1065
- +property: $NonMaybeType<OptionalMemberExpression['property']>;
1066
- }
1067
- interface OptionalMemberExpression_With_computed
1068
- extends OptionalMemberExpression {
1069
- +computed: $NonMaybeType<OptionalMemberExpression['computed']>;
1070
- }
1071
- interface OptionalMemberExpression_With_optional
1072
- extends OptionalMemberExpression {
1073
- +optional: $NonMaybeType<OptionalMemberExpression['optional']>;
1074
- }
1075
- interface PrivateName_With_id extends PrivateName {
1076
- +id: $NonMaybeType<PrivateName['id']>;
999
+ interface PrivateIdentifier_With_name extends PrivateIdentifier {
1000
+ +name: $NonMaybeType<PrivateIdentifier['name']>;
1077
1001
  }
1078
1002
  interface Program_With_body extends Program {
1079
1003
  +body: $NonMaybeType<Program['body']>;
@@ -1096,6 +1020,30 @@ interface Property_With_method extends Property {
1096
1020
  interface Property_With_shorthand extends Property {
1097
1021
  +shorthand: $NonMaybeType<Property['shorthand']>;
1098
1022
  }
1023
+ interface PropertyDefinition_With_key extends PropertyDefinition {
1024
+ +key: $NonMaybeType<PropertyDefinition['key']>;
1025
+ }
1026
+ interface PropertyDefinition_With_value extends PropertyDefinition {
1027
+ +value: $NonMaybeType<PropertyDefinition['value']>;
1028
+ }
1029
+ interface PropertyDefinition_With_computed extends PropertyDefinition {
1030
+ +computed: $NonMaybeType<PropertyDefinition['computed']>;
1031
+ }
1032
+ interface PropertyDefinition_With_static extends PropertyDefinition {
1033
+ +static: $NonMaybeType<PropertyDefinition['static']>;
1034
+ }
1035
+ interface PropertyDefinition_With_declare extends PropertyDefinition {
1036
+ +declare: $NonMaybeType<PropertyDefinition['declare']>;
1037
+ }
1038
+ interface PropertyDefinition_With_optional extends PropertyDefinition {
1039
+ +optional: $NonMaybeType<PropertyDefinition['optional']>;
1040
+ }
1041
+ interface PropertyDefinition_With_variance extends PropertyDefinition {
1042
+ +variance: $NonMaybeType<PropertyDefinition['variance']>;
1043
+ }
1044
+ interface PropertyDefinition_With_typeAnnotation extends PropertyDefinition {
1045
+ +typeAnnotation: $NonMaybeType<PropertyDefinition['typeAnnotation']>;
1046
+ }
1099
1047
  interface QualifiedTypeIdentifier_With_qualification
1100
1048
  extends QualifiedTypeIdentifier {
1101
1049
  +qualification: $NonMaybeType<QualifiedTypeIdentifier['qualification']>;
@@ -1309,6 +1257,7 @@ type ExpressionSpecialSelector =
1309
1257
  | AwaitExpression
1310
1258
  | BinaryExpression
1311
1259
  | CallExpression
1260
+ | ChainExpression
1312
1261
  | ClassExpression
1313
1262
  | ConditionalExpression
1314
1263
  | FunctionExpression
@@ -1319,8 +1268,6 @@ type ExpressionSpecialSelector =
1319
1268
  | MemberExpression
1320
1269
  | NewExpression
1321
1270
  | ObjectExpression
1322
- | OptionalCallExpression
1323
- | OptionalMemberExpression
1324
1271
  | SequenceExpression
1325
1272
  | TaggedTemplateExpression
1326
1273
  | ThisExpression
@@ -1421,6 +1368,10 @@ export type ESQueryNodeSelectorsWithoutFallback = {
1421
1368
  +CatchClause?: (node: CatchClause) => void,
1422
1369
  +'CatchClause[param]'?: (node: CatchClause_With_param) => void,
1423
1370
  +'CatchClause[body]'?: (node: CatchClause_With_body) => void,
1371
+ +ChainExpression?: (node: ChainExpression) => void,
1372
+ +'ChainExpression[expression]'?: (
1373
+ node: ChainExpression_With_expression,
1374
+ ) => void,
1424
1375
  +ClassBody?: (node: ClassBody) => void,
1425
1376
  +'ClassBody[body]'?: (node: ClassBody_With_body) => void,
1426
1377
  +ClassDeclaration?: (node: ClassDeclaration) => void,
@@ -1464,37 +1415,6 @@ export type ESQueryNodeSelectorsWithoutFallback = {
1464
1415
  +'ClassImplements[typeParameters]'?: (
1465
1416
  node: ClassImplements_With_typeParameters,
1466
1417
  ) => void,
1467
- +ClassPrivateProperty?: (node: ClassPrivateProperty) => void,
1468
- +'ClassPrivateProperty[key]'?: (node: ClassPrivateProperty_With_key) => void,
1469
- +'ClassPrivateProperty[value]'?: (
1470
- node: ClassPrivateProperty_With_value,
1471
- ) => void,
1472
- +'ClassPrivateProperty[static]'?: (
1473
- node: ClassPrivateProperty_With_static,
1474
- ) => void,
1475
- +'ClassPrivateProperty[declare]'?: (
1476
- node: ClassPrivateProperty_With_declare,
1477
- ) => void,
1478
- +'ClassPrivateProperty[optional]'?: (
1479
- node: ClassPrivateProperty_With_optional,
1480
- ) => void,
1481
- +'ClassPrivateProperty[variance]'?: (
1482
- node: ClassPrivateProperty_With_variance,
1483
- ) => void,
1484
- +'ClassPrivateProperty[typeAnnotation]'?: (
1485
- node: ClassPrivateProperty_With_typeAnnotation,
1486
- ) => void,
1487
- +ClassProperty?: (node: ClassProperty) => void,
1488
- +'ClassProperty[key]'?: (node: ClassProperty_With_key) => void,
1489
- +'ClassProperty[value]'?: (node: ClassProperty_With_value) => void,
1490
- +'ClassProperty[computed]'?: (node: ClassProperty_With_computed) => void,
1491
- +'ClassProperty[static]'?: (node: ClassProperty_With_static) => void,
1492
- +'ClassProperty[declare]'?: (node: ClassProperty_With_declare) => void,
1493
- +'ClassProperty[optional]'?: (node: ClassProperty_With_optional) => void,
1494
- +'ClassProperty[variance]'?: (node: ClassProperty_With_variance) => void,
1495
- +'ClassProperty[typeAnnotation]'?: (
1496
- node: ClassProperty_With_typeAnnotation,
1497
- ) => void,
1498
1418
  +ConditionalExpression?: (node: ConditionalExpression) => void,
1499
1419
  +'ConditionalExpression[test]'?: (
1500
1420
  node: ConditionalExpression_With_test,
@@ -1625,6 +1545,9 @@ export type ESQueryNodeSelectorsWithoutFallback = {
1625
1545
  ) => void,
1626
1546
  +ExistsTypeAnnotation?: (node: ExistsTypeAnnotation) => void,
1627
1547
  +ExportAllDeclaration?: (node: ExportAllDeclaration) => void,
1548
+ +'ExportAllDeclaration[exported]'?: (
1549
+ node: ExportAllDeclaration_With_exported,
1550
+ ) => void,
1628
1551
  +'ExportAllDeclaration[source]'?: (
1629
1552
  node: ExportAllDeclaration_With_source,
1630
1553
  ) => void,
@@ -1648,10 +1571,6 @@ export type ESQueryNodeSelectorsWithoutFallback = {
1648
1571
  +'ExportNamedDeclaration[exportKind]'?: (
1649
1572
  node: ExportNamedDeclaration_With_exportKind,
1650
1573
  ) => void,
1651
- +ExportNamespaceSpecifier?: (node: ExportNamespaceSpecifier) => void,
1652
- +'ExportNamespaceSpecifier[exported]'?: (
1653
- node: ExportNamespaceSpecifier_With_exported,
1654
- ) => void,
1655
1574
  +ExportSpecifier?: (node: ExportSpecifier) => void,
1656
1575
  +'ExportSpecifier[exported]'?: (node: ExportSpecifier_With_exported) => void,
1657
1576
  +'ExportSpecifier[local]'?: (node: ExportSpecifier_With_local) => void,
@@ -2019,19 +1938,6 @@ export type ESQueryNodeSelectorsWithoutFallback = {
2019
1938
  ) => void,
2020
1939
  +'OpaqueType[impltype]'?: (node: OpaqueType_With_impltype) => void,
2021
1940
  +'OpaqueType[supertype]'?: (node: OpaqueType_With_supertype) => void,
2022
- +OptionalCallExpression?: (node: OptionalCallExpression) => void,
2023
- +'OptionalCallExpression[callee]'?: (
2024
- node: OptionalCallExpression_With_callee,
2025
- ) => void,
2026
- +'OptionalCallExpression[typeArguments]'?: (
2027
- node: OptionalCallExpression_With_typeArguments,
2028
- ) => void,
2029
- +'OptionalCallExpression[arguments]'?: (
2030
- node: OptionalCallExpression_With_arguments,
2031
- ) => void,
2032
- +'OptionalCallExpression[optional]'?: (
2033
- node: OptionalCallExpression_With_optional,
2034
- ) => void,
2035
1941
  +OptionalIndexedAccessType?: (node: OptionalIndexedAccessType) => void,
2036
1942
  +'OptionalIndexedAccessType[objectType]'?: (
2037
1943
  node: OptionalIndexedAccessType_With_objectType,
@@ -2042,21 +1948,8 @@ export type ESQueryNodeSelectorsWithoutFallback = {
2042
1948
  +'OptionalIndexedAccessType[optional]'?: (
2043
1949
  node: OptionalIndexedAccessType_With_optional,
2044
1950
  ) => void,
2045
- +OptionalMemberExpression?: (node: OptionalMemberExpression) => void,
2046
- +'OptionalMemberExpression[object]'?: (
2047
- node: OptionalMemberExpression_With_object,
2048
- ) => void,
2049
- +'OptionalMemberExpression[property]'?: (
2050
- node: OptionalMemberExpression_With_property,
2051
- ) => void,
2052
- +'OptionalMemberExpression[computed]'?: (
2053
- node: OptionalMemberExpression_With_computed,
2054
- ) => void,
2055
- +'OptionalMemberExpression[optional]'?: (
2056
- node: OptionalMemberExpression_With_optional,
2057
- ) => void,
2058
- +PrivateName?: (node: PrivateName) => void,
2059
- +'PrivateName[id]'?: (node: PrivateName_With_id) => void,
1951
+ +PrivateIdentifier?: (node: PrivateIdentifier) => void,
1952
+ +'PrivateIdentifier[name]'?: (node: PrivateIdentifier_With_name) => void,
2060
1953
  +Program?: (node: Program) => void,
2061
1954
  +'Program[body]'?: (node: Program_With_body) => void,
2062
1955
  +Property?: (node: Property) => void,
@@ -2066,6 +1959,27 @@ export type ESQueryNodeSelectorsWithoutFallback = {
2066
1959
  +'Property[computed]'?: (node: Property_With_computed) => void,
2067
1960
  +'Property[method]'?: (node: Property_With_method) => void,
2068
1961
  +'Property[shorthand]'?: (node: Property_With_shorthand) => void,
1962
+ +PropertyDefinition?: (node: PropertyDefinition) => void,
1963
+ +'PropertyDefinition[key]'?: (node: PropertyDefinition_With_key) => void,
1964
+ +'PropertyDefinition[value]'?: (node: PropertyDefinition_With_value) => void,
1965
+ +'PropertyDefinition[computed]'?: (
1966
+ node: PropertyDefinition_With_computed,
1967
+ ) => void,
1968
+ +'PropertyDefinition[static]'?: (
1969
+ node: PropertyDefinition_With_static,
1970
+ ) => void,
1971
+ +'PropertyDefinition[declare]'?: (
1972
+ node: PropertyDefinition_With_declare,
1973
+ ) => void,
1974
+ +'PropertyDefinition[optional]'?: (
1975
+ node: PropertyDefinition_With_optional,
1976
+ ) => void,
1977
+ +'PropertyDefinition[variance]'?: (
1978
+ node: PropertyDefinition_With_variance,
1979
+ ) => void,
1980
+ +'PropertyDefinition[typeAnnotation]'?: (
1981
+ node: PropertyDefinition_With_typeAnnotation,
1982
+ ) => void,
2069
1983
  +QualifiedTypeIdentifier?: (node: QualifiedTypeIdentifier) => void,
2070
1984
  +'QualifiedTypeIdentifier[qualification]'?: (
2071
1985
  node: QualifiedTypeIdentifier_With_qualification,
@@ -2302,6 +2216,10 @@ export type ESQueryNodeSelectorsWithoutFallback = {
2302
2216
  +'CatchClause:exit'?: (node: CatchClause) => void,
2303
2217
  +'CatchClause[param]:exit'?: (node: CatchClause_With_param) => void,
2304
2218
  +'CatchClause[body]:exit'?: (node: CatchClause_With_body) => void,
2219
+ +'ChainExpression:exit'?: (node: ChainExpression) => void,
2220
+ +'ChainExpression[expression]:exit'?: (
2221
+ node: ChainExpression_With_expression,
2222
+ ) => void,
2305
2223
  +'ClassBody:exit'?: (node: ClassBody) => void,
2306
2224
  +'ClassBody[body]:exit'?: (node: ClassBody_With_body) => void,
2307
2225
  +'ClassDeclaration:exit'?: (node: ClassDeclaration) => void,
@@ -2345,39 +2263,6 @@ export type ESQueryNodeSelectorsWithoutFallback = {
2345
2263
  +'ClassImplements[typeParameters]:exit'?: (
2346
2264
  node: ClassImplements_With_typeParameters,
2347
2265
  ) => void,
2348
- +'ClassPrivateProperty:exit'?: (node: ClassPrivateProperty) => void,
2349
- +'ClassPrivateProperty[key]:exit'?: (
2350
- node: ClassPrivateProperty_With_key,
2351
- ) => void,
2352
- +'ClassPrivateProperty[value]:exit'?: (
2353
- node: ClassPrivateProperty_With_value,
2354
- ) => void,
2355
- +'ClassPrivateProperty[static]:exit'?: (
2356
- node: ClassPrivateProperty_With_static,
2357
- ) => void,
2358
- +'ClassPrivateProperty[declare]:exit'?: (
2359
- node: ClassPrivateProperty_With_declare,
2360
- ) => void,
2361
- +'ClassPrivateProperty[optional]:exit'?: (
2362
- node: ClassPrivateProperty_With_optional,
2363
- ) => void,
2364
- +'ClassPrivateProperty[variance]:exit'?: (
2365
- node: ClassPrivateProperty_With_variance,
2366
- ) => void,
2367
- +'ClassPrivateProperty[typeAnnotation]:exit'?: (
2368
- node: ClassPrivateProperty_With_typeAnnotation,
2369
- ) => void,
2370
- +'ClassProperty:exit'?: (node: ClassProperty) => void,
2371
- +'ClassProperty[key]:exit'?: (node: ClassProperty_With_key) => void,
2372
- +'ClassProperty[value]:exit'?: (node: ClassProperty_With_value) => void,
2373
- +'ClassProperty[computed]:exit'?: (node: ClassProperty_With_computed) => void,
2374
- +'ClassProperty[static]:exit'?: (node: ClassProperty_With_static) => void,
2375
- +'ClassProperty[declare]:exit'?: (node: ClassProperty_With_declare) => void,
2376
- +'ClassProperty[optional]:exit'?: (node: ClassProperty_With_optional) => void,
2377
- +'ClassProperty[variance]:exit'?: (node: ClassProperty_With_variance) => void,
2378
- +'ClassProperty[typeAnnotation]:exit'?: (
2379
- node: ClassProperty_With_typeAnnotation,
2380
- ) => void,
2381
2266
  +'ConditionalExpression:exit'?: (node: ConditionalExpression) => void,
2382
2267
  +'ConditionalExpression[test]:exit'?: (
2383
2268
  node: ConditionalExpression_With_test,
@@ -2520,6 +2405,9 @@ export type ESQueryNodeSelectorsWithoutFallback = {
2520
2405
  ) => void,
2521
2406
  +'ExistsTypeAnnotation:exit'?: (node: ExistsTypeAnnotation) => void,
2522
2407
  +'ExportAllDeclaration:exit'?: (node: ExportAllDeclaration) => void,
2408
+ +'ExportAllDeclaration[exported]:exit'?: (
2409
+ node: ExportAllDeclaration_With_exported,
2410
+ ) => void,
2523
2411
  +'ExportAllDeclaration[source]:exit'?: (
2524
2412
  node: ExportAllDeclaration_With_source,
2525
2413
  ) => void,
@@ -2543,10 +2431,6 @@ export type ESQueryNodeSelectorsWithoutFallback = {
2543
2431
  +'ExportNamedDeclaration[exportKind]:exit'?: (
2544
2432
  node: ExportNamedDeclaration_With_exportKind,
2545
2433
  ) => void,
2546
- +'ExportNamespaceSpecifier:exit'?: (node: ExportNamespaceSpecifier) => void,
2547
- +'ExportNamespaceSpecifier[exported]:exit'?: (
2548
- node: ExportNamespaceSpecifier_With_exported,
2549
- ) => void,
2550
2434
  +'ExportSpecifier:exit'?: (node: ExportSpecifier) => void,
2551
2435
  +'ExportSpecifier[exported]:exit'?: (
2552
2436
  node: ExportSpecifier_With_exported,
@@ -2956,19 +2840,6 @@ export type ESQueryNodeSelectorsWithoutFallback = {
2956
2840
  ) => void,
2957
2841
  +'OpaqueType[impltype]:exit'?: (node: OpaqueType_With_impltype) => void,
2958
2842
  +'OpaqueType[supertype]:exit'?: (node: OpaqueType_With_supertype) => void,
2959
- +'OptionalCallExpression:exit'?: (node: OptionalCallExpression) => void,
2960
- +'OptionalCallExpression[callee]:exit'?: (
2961
- node: OptionalCallExpression_With_callee,
2962
- ) => void,
2963
- +'OptionalCallExpression[typeArguments]:exit'?: (
2964
- node: OptionalCallExpression_With_typeArguments,
2965
- ) => void,
2966
- +'OptionalCallExpression[arguments]:exit'?: (
2967
- node: OptionalCallExpression_With_arguments,
2968
- ) => void,
2969
- +'OptionalCallExpression[optional]:exit'?: (
2970
- node: OptionalCallExpression_With_optional,
2971
- ) => void,
2972
2843
  +'OptionalIndexedAccessType:exit'?: (node: OptionalIndexedAccessType) => void,
2973
2844
  +'OptionalIndexedAccessType[objectType]:exit'?: (
2974
2845
  node: OptionalIndexedAccessType_With_objectType,
@@ -2979,21 +2850,8 @@ export type ESQueryNodeSelectorsWithoutFallback = {
2979
2850
  +'OptionalIndexedAccessType[optional]:exit'?: (
2980
2851
  node: OptionalIndexedAccessType_With_optional,
2981
2852
  ) => void,
2982
- +'OptionalMemberExpression:exit'?: (node: OptionalMemberExpression) => void,
2983
- +'OptionalMemberExpression[object]:exit'?: (
2984
- node: OptionalMemberExpression_With_object,
2985
- ) => void,
2986
- +'OptionalMemberExpression[property]:exit'?: (
2987
- node: OptionalMemberExpression_With_property,
2988
- ) => void,
2989
- +'OptionalMemberExpression[computed]:exit'?: (
2990
- node: OptionalMemberExpression_With_computed,
2991
- ) => void,
2992
- +'OptionalMemberExpression[optional]:exit'?: (
2993
- node: OptionalMemberExpression_With_optional,
2994
- ) => void,
2995
- +'PrivateName:exit'?: (node: PrivateName) => void,
2996
- +'PrivateName[id]:exit'?: (node: PrivateName_With_id) => void,
2853
+ +'PrivateIdentifier:exit'?: (node: PrivateIdentifier) => void,
2854
+ +'PrivateIdentifier[name]:exit'?: (node: PrivateIdentifier_With_name) => void,
2997
2855
  +'Program:exit'?: (node: Program) => void,
2998
2856
  +'Program[body]:exit'?: (node: Program_With_body) => void,
2999
2857
  +'Property:exit'?: (node: Property) => void,
@@ -3003,6 +2861,29 @@ export type ESQueryNodeSelectorsWithoutFallback = {
3003
2861
  +'Property[computed]:exit'?: (node: Property_With_computed) => void,
3004
2862
  +'Property[method]:exit'?: (node: Property_With_method) => void,
3005
2863
  +'Property[shorthand]:exit'?: (node: Property_With_shorthand) => void,
2864
+ +'PropertyDefinition:exit'?: (node: PropertyDefinition) => void,
2865
+ +'PropertyDefinition[key]:exit'?: (node: PropertyDefinition_With_key) => void,
2866
+ +'PropertyDefinition[value]:exit'?: (
2867
+ node: PropertyDefinition_With_value,
2868
+ ) => void,
2869
+ +'PropertyDefinition[computed]:exit'?: (
2870
+ node: PropertyDefinition_With_computed,
2871
+ ) => void,
2872
+ +'PropertyDefinition[static]:exit'?: (
2873
+ node: PropertyDefinition_With_static,
2874
+ ) => void,
2875
+ +'PropertyDefinition[declare]:exit'?: (
2876
+ node: PropertyDefinition_With_declare,
2877
+ ) => void,
2878
+ +'PropertyDefinition[optional]:exit'?: (
2879
+ node: PropertyDefinition_With_optional,
2880
+ ) => void,
2881
+ +'PropertyDefinition[variance]:exit'?: (
2882
+ node: PropertyDefinition_With_variance,
2883
+ ) => void,
2884
+ +'PropertyDefinition[typeAnnotation]:exit'?: (
2885
+ node: PropertyDefinition_With_typeAnnotation,
2886
+ ) => void,
3006
2887
  +'QualifiedTypeIdentifier:exit'?: (node: QualifiedTypeIdentifier) => void,
3007
2888
  +'QualifiedTypeIdentifier[qualification]:exit'?: (
3008
2889
  node: QualifiedTypeIdentifier_With_qualification,
@@ -53,12 +53,11 @@ exports.isCallExpression = isCallExpression;
53
53
  exports.isCaseToken = isCaseToken;
54
54
  exports.isCatchClause = isCatchClause;
55
55
  exports.isCatchToken = isCatchToken;
56
+ exports.isChainExpression = isChainExpression;
56
57
  exports.isClassBody = isClassBody;
57
58
  exports.isClassDeclaration = isClassDeclaration;
58
59
  exports.isClassExpression = isClassExpression;
59
60
  exports.isClassImplements = isClassImplements;
60
- exports.isClassPrivateProperty = isClassPrivateProperty;
61
- exports.isClassProperty = isClassProperty;
62
61
  exports.isClassToken = isClassToken;
63
62
  exports.isClosingAngleBracketToken = isClosingAngleBracketToken;
64
63
  exports.isClosingCurlyBracketToken = isClosingCurlyBracketToken;
@@ -111,7 +110,6 @@ exports.isExponentiationToken = isExponentiationToken;
111
110
  exports.isExportAllDeclaration = isExportAllDeclaration;
112
111
  exports.isExportDefaultDeclaration = isExportDefaultDeclaration;
113
112
  exports.isExportNamedDeclaration = isExportNamedDeclaration;
114
- exports.isExportNamespaceSpecifier = isExportNamespaceSpecifier;
115
113
  exports.isExportSpecifier = isExportSpecifier;
116
114
  exports.isExportToken = isExportToken;
117
115
  exports.isExpressionStatement = isExpressionStatement;
@@ -212,15 +210,14 @@ exports.isOpaqueType = isOpaqueType;
212
210
  exports.isOpeningAngleBracketToken = isOpeningAngleBracketToken;
213
211
  exports.isOpeningCurlyBracketToken = isOpeningCurlyBracketToken;
214
212
  exports.isOpeningParenthesisToken = isOpeningParenthesisToken;
215
- exports.isOptionalCallExpression = isOptionalCallExpression;
216
213
  exports.isOptionalChainToken = isOptionalChainToken;
217
214
  exports.isOptionalIndexedAccessType = isOptionalIndexedAccessType;
218
- exports.isOptionalMemberExpression = isOptionalMemberExpression;
219
215
  exports.isPercentToken = isPercentToken;
220
216
  exports.isPlusEqualToken = isPlusEqualToken;
221
217
  exports.isPlusToken = isPlusToken;
222
- exports.isPrivateName = isPrivateName;
218
+ exports.isPrivateIdentifier = isPrivateIdentifier;
223
219
  exports.isProperty = isProperty;
220
+ exports.isPropertyDefinition = isPropertyDefinition;
224
221
  exports.isQualifiedTypeIdentifier = isQualifiedTypeIdentifier;
225
222
  exports.isQuestionMarkToken = isQuestionMarkToken;
226
223
  exports.isRemainderEqualToken = isRemainderEqualToken;
@@ -344,6 +341,10 @@ function isCatchClause(node) {
344
341
  return node.type === 'CatchClause';
345
342
  }
346
343
 
344
+ function isChainExpression(node) {
345
+ return node.type === 'ChainExpression';
346
+ }
347
+
347
348
  function isClassBody(node) {
348
349
  return node.type === 'ClassBody';
349
350
  }
@@ -360,14 +361,6 @@ function isClassImplements(node) {
360
361
  return node.type === 'ClassImplements';
361
362
  }
362
363
 
363
- function isClassPrivateProperty(node) {
364
- return node.type === 'ClassPrivateProperty';
365
- }
366
-
367
- function isClassProperty(node) {
368
- return node.type === 'ClassProperty';
369
- }
370
-
371
364
  function isConditionalExpression(node) {
372
365
  return node.type === 'ConditionalExpression';
373
366
  }
@@ -488,10 +481,6 @@ function isExportNamedDeclaration(node) {
488
481
  return node.type === 'ExportNamedDeclaration';
489
482
  }
490
483
 
491
- function isExportNamespaceSpecifier(node) {
492
- return node.type === 'ExportNamespaceSpecifier';
493
- }
494
-
495
484
  function isExportSpecifier(node) {
496
485
  return node.type === 'ExportSpecifier';
497
486
  }
@@ -728,26 +717,22 @@ function isOpaqueType(node) {
728
717
  return node.type === 'OpaqueType';
729
718
  }
730
719
 
731
- function isOptionalCallExpression(node) {
732
- return node.type === 'OptionalCallExpression';
733
- }
734
-
735
720
  function isOptionalIndexedAccessType(node) {
736
721
  return node.type === 'OptionalIndexedAccessType';
737
722
  }
738
723
 
739
- function isOptionalMemberExpression(node) {
740
- return node.type === 'OptionalMemberExpression';
741
- }
742
-
743
- function isPrivateName(node) {
744
- return node.type === 'PrivateName';
724
+ function isPrivateIdentifier(node) {
725
+ return node.type === 'PrivateIdentifier';
745
726
  }
746
727
 
747
728
  function isProperty(node) {
748
729
  return node.type === 'Property';
749
730
  }
750
731
 
732
+ function isPropertyDefinition(node) {
733
+ return node.type === 'PropertyDefinition';
734
+ }
735
+
751
736
  function isQualifiedTypeIdentifier(node) {
752
737
  return node.type === 'QualifiedTypeIdentifier';
753
738
  }
@@ -86,6 +86,10 @@ export function isCatchClause(node: ESNode | Token): boolean %checks {
86
86
  return node.type === 'CatchClause';
87
87
  }
88
88
 
89
+ export function isChainExpression(node: ESNode | Token): boolean %checks {
90
+ return node.type === 'ChainExpression';
91
+ }
92
+
89
93
  export function isClassBody(node: ESNode | Token): boolean %checks {
90
94
  return node.type === 'ClassBody';
91
95
  }
@@ -102,14 +106,6 @@ export function isClassImplements(node: ESNode | Token): boolean %checks {
102
106
  return node.type === 'ClassImplements';
103
107
  }
104
108
 
105
- export function isClassPrivateProperty(node: ESNode | Token): boolean %checks {
106
- return node.type === 'ClassPrivateProperty';
107
- }
108
-
109
- export function isClassProperty(node: ESNode | Token): boolean %checks {
110
- return node.type === 'ClassProperty';
111
- }
112
-
113
109
  export function isConditionalExpression(node: ESNode | Token): boolean %checks {
114
110
  return node.type === 'ConditionalExpression';
115
111
  }
@@ -238,12 +234,6 @@ export function isExportNamedDeclaration(
238
234
  return node.type === 'ExportNamedDeclaration';
239
235
  }
240
236
 
241
- export function isExportNamespaceSpecifier(
242
- node: ESNode | Token,
243
- ): boolean %checks {
244
- return node.type === 'ExportNamespaceSpecifier';
245
- }
246
-
247
237
  export function isExportSpecifier(node: ESNode | Token): boolean %checks {
248
238
  return node.type === 'ExportSpecifier';
249
239
  }
@@ -504,32 +494,24 @@ export function isOpaqueType(node: ESNode | Token): boolean %checks {
504
494
  return node.type === 'OpaqueType';
505
495
  }
506
496
 
507
- export function isOptionalCallExpression(
508
- node: ESNode | Token,
509
- ): boolean %checks {
510
- return node.type === 'OptionalCallExpression';
511
- }
512
-
513
497
  export function isOptionalIndexedAccessType(
514
498
  node: ESNode | Token,
515
499
  ): boolean %checks {
516
500
  return node.type === 'OptionalIndexedAccessType';
517
501
  }
518
502
 
519
- export function isOptionalMemberExpression(
520
- node: ESNode | Token,
521
- ): boolean %checks {
522
- return node.type === 'OptionalMemberExpression';
523
- }
524
-
525
- export function isPrivateName(node: ESNode | Token): boolean %checks {
526
- return node.type === 'PrivateName';
503
+ export function isPrivateIdentifier(node: ESNode | Token): boolean %checks {
504
+ return node.type === 'PrivateIdentifier';
527
505
  }
528
506
 
529
507
  export function isProperty(node: ESNode | Token): boolean %checks {
530
508
  return node.type === 'Property';
531
509
  }
532
510
 
511
+ export function isPropertyDefinition(node: ESNode | Token): boolean %checks {
512
+ return node.type === 'PropertyDefinition';
513
+ }
514
+
533
515
  export function isQualifiedTypeIdentifier(
534
516
  node: ESNode | Token,
535
517
  ): boolean %checks {
@@ -14,7 +14,7 @@ Object.defineProperty(exports, "__esModule", {
14
14
  });
15
15
  var _exportNames = {
16
16
  isClass: true,
17
- isClassPropertyWithNonComputedName: true,
17
+ isPropertyDefinitionWithNonComputedName: true,
18
18
  isClassMember: true,
19
19
  isClassMemberWithNonComputedName: true,
20
20
  isComment: true,
@@ -36,7 +36,6 @@ exports.isBooleanLiteral = isBooleanLiteral;
36
36
  exports.isClass = isClass;
37
37
  exports.isClassMember = isClassMember;
38
38
  exports.isClassMemberWithNonComputedName = isClassMemberWithNonComputedName;
39
- exports.isClassPropertyWithNonComputedName = isClassPropertyWithNonComputedName;
40
39
  exports.isComment = isComment;
41
40
  exports.isFunction = isFunction;
42
41
  exports.isMemberExpressionWithNonComputedProperty = isMemberExpressionWithNonComputedProperty;
@@ -46,6 +45,7 @@ exports.isNumericLiteral = isNumericLiteral;
46
45
  exports.isObjectPropertyWithNonComputedName = isObjectPropertyWithNonComputedName;
47
46
  exports.isObjectPropertyWithShorthand = isObjectPropertyWithShorthand;
48
47
  exports.isOptionalMemberExpressionWithNonComputedProperty = isOptionalMemberExpressionWithNonComputedProperty;
48
+ exports.isPropertyDefinitionWithNonComputedName = isPropertyDefinitionWithNonComputedName;
49
49
  exports.isRegExpLiteral = isRegExpLiteral;
50
50
  exports.isStringLiteral = isStringLiteral;
51
51
 
@@ -62,12 +62,12 @@ function isClass(node) {
62
62
  return (0, _predicates.isClassDeclaration)(node) || (0, _predicates.isClassExpression)(node);
63
63
  }
64
64
 
65
- function isClassPropertyWithNonComputedName(node) {
66
- return (0, _predicates.isClassProperty)(node) && node.computed === false;
65
+ function isPropertyDefinitionWithNonComputedName(node) {
66
+ return (0, _predicates.isPropertyDefinition)(node) && node.computed === false;
67
67
  }
68
68
 
69
69
  function isClassMember(node) {
70
- return (0, _predicates.isClassProperty)(node) || (0, _predicates.isClassPrivateProperty)(node) || (0, _predicates.isMethodDefinition)(node);
70
+ return (0, _predicates.isPropertyDefinition)(node) || (0, _predicates.isMethodDefinition)(node);
71
71
  }
72
72
 
73
73
  function isClassMemberWithNonComputedName(node) {
@@ -17,14 +17,13 @@ import {
17
17
  isBlockComment,
18
18
  isClassDeclaration,
19
19
  isClassExpression,
20
- isClassPrivateProperty,
21
- isClassProperty,
22
20
  isFunctionDeclaration,
23
21
  isFunctionExpression,
24
22
  isLineComment,
25
23
  isLiteral,
26
24
  isMemberExpression,
27
25
  isMethodDefinition,
26
+ isPropertyDefinition,
28
27
  isProperty,
29
28
  } from './generated/predicates';
30
29
 
@@ -34,18 +33,14 @@ export function isClass(node: ESNode): boolean %checks {
34
33
  return isClassDeclaration(node) || isClassExpression(node);
35
34
  }
36
35
 
37
- export function isClassPropertyWithNonComputedName(
36
+ export function isPropertyDefinitionWithNonComputedName(
38
37
  node: ESNode,
39
38
  ): boolean %checks {
40
- return isClassProperty(node) && node.computed === false;
39
+ return isPropertyDefinition(node) && node.computed === false;
41
40
  }
42
41
 
43
42
  export function isClassMember(node: ESNode): boolean %checks {
44
- return (
45
- isClassProperty(node) ||
46
- isClassPrivateProperty(node) ||
47
- isMethodDefinition(node)
48
- );
43
+ return isPropertyDefinition(node) || isMethodDefinition(node);
49
44
  }
50
45
 
51
46
  export function isClassMemberWithNonComputedName(
@@ -105,6 +105,26 @@ export interface Position {
105
105
  +column: number;
106
106
  }
107
107
 
108
+ // note: this is only ever present on Program.interpreter, never in the body
109
+ interface InterpreterDirective extends BaseNode {
110
+ type: 'InterpreterDirective';
111
+ value: string;
112
+ }
113
+
114
+ export type DocblockDirectives = $ReadOnly<{
115
+ // some well-known tags
116
+ flow?: $ReadOnlyArray<string> | void,
117
+ format?: $ReadOnlyArray<string> | void,
118
+ noflow?: $ReadOnlyArray<string> | void,
119
+ noformat?: $ReadOnlyArray<string> | void,
120
+ [string]: $ReadOnlyArray<string> | void,
121
+ }>;
122
+
123
+ export type DocblockMetadata = $ReadOnly<{
124
+ directives: DocblockDirectives,
125
+ comment: BlockComment,
126
+ }>;
127
+
108
128
  export interface Program extends BaseNode {
109
129
  +type: 'Program';
110
130
  +sourceType: 'script' | 'module';
@@ -112,6 +132,8 @@ export interface Program extends BaseNode {
112
132
  +tokens: $ReadOnlyArray<Token>;
113
133
  +comments: $ReadOnlyArray<Comment>;
114
134
  +loc: SourceLocation;
135
+ +interpreter: null | InterpreterDirective;
136
+ +docblock: null | DocblockMetadata;
115
137
  // program is the only node without a parent - but typing it as such is _super_ annoying and difficult
116
138
  +parent: ESNode;
117
139
  }
@@ -120,6 +142,7 @@ export interface Program extends BaseNode {
120
142
  // Because this file declares global types - we can't clash with it
121
143
  export type ESNode =
122
144
  | Identifier
145
+ | PrivateIdentifier
123
146
  | Literal
124
147
  | Program
125
148
  | AFunction
@@ -139,6 +162,7 @@ export type ESNode =
139
162
  | ClassBody
140
163
  | AClass
141
164
  | MethodDefinition
165
+ | PropertyDefinition
142
166
  | ModuleDeclaration
143
167
  | ModuleSpecifier
144
168
  | ImportAttribute
@@ -153,9 +177,6 @@ export type ESNode =
153
177
  | ObjectTypeIndexer
154
178
  | ObjectTypeSpreadProperty
155
179
  | InterfaceExtends
156
- | ClassProperty
157
- | ClassPrivateProperty
158
- | PrivateName
159
180
  | ClassImplements
160
181
  | Decorator
161
182
  | TypeParameterDeclaration
@@ -221,7 +242,9 @@ export type Statement =
221
242
  | TypeAlias
222
243
  | OpaqueType
223
244
  | InterfaceDeclaration
224
- | Declaration
245
+ | FunctionDeclaration
246
+ | VariableDeclaration
247
+ | ClassDeclaration
225
248
  | DeclareTypeAlias
226
249
  | DeclareOpaqueType
227
250
  | DeclareInterface
@@ -347,11 +370,6 @@ export interface DebuggerStatement extends BaseNode {
347
370
  +type: 'DebuggerStatement';
348
371
  }
349
372
 
350
- export type Declaration =
351
- | FunctionDeclaration
352
- | VariableDeclaration
353
- | ClassDeclaration;
354
-
355
373
  export interface FunctionDeclaration extends BaseFunction {
356
374
  +type: 'FunctionDeclaration';
357
375
  /** It is null when a function declaration is a part of the `export default function` statement */
@@ -386,10 +404,8 @@ export type Expression =
386
404
  | AssignmentExpression
387
405
  | LogicalExpression
388
406
  | MemberExpression
389
- | OptionalMemberExpression
390
407
  | ConditionalExpression
391
408
  | CallExpression
392
- | OptionalCallExpression
393
409
  | NewExpression
394
410
  | SequenceExpression
395
411
  | TemplateLiteral
@@ -522,15 +538,24 @@ export interface UnaryExpression extends BaseNode {
522
538
  +argument: Expression;
523
539
  }
524
540
 
525
- export interface BinaryExpression extends BaseNode {
541
+ export interface BinaryExpressionWithoutIn extends BaseNode {
526
542
  +type: 'BinaryExpression';
527
- +operator: BinaryOperator;
543
+ +operator: BinaryOperatorWithoutIn;
528
544
  +left: Expression;
529
545
  +right: Expression;
530
- // once private brand checks are supported: `#x in this`
531
- // | PrivateName;
532
546
  }
533
547
 
548
+ // Private brand checks (#foo in bar) are a special case
549
+ // other binary expressions do not allow PrivateIdentifier in the left
550
+ export interface BinaryExpressionIn extends BaseNode {
551
+ +type: 'BinaryExpression';
552
+ +operator: 'in';
553
+ +left: Expression | PrivateIdentifier;
554
+ +right: Expression;
555
+ }
556
+
557
+ export type BinaryExpression = BinaryExpressionWithoutIn | BinaryExpressionIn;
558
+
534
559
  export interface AssignmentExpression extends BaseNode {
535
560
  +type: 'AssignmentExpression';
536
561
  +operator: AssignmentOperator;
@@ -566,34 +591,31 @@ interface BaseCallExpression extends BaseNode {
566
591
  }
567
592
  export interface CallExpression extends BaseCallExpression {
568
593
  +type: 'CallExpression';
594
+ +optional: boolean;
569
595
  }
570
596
 
571
597
  export interface NewExpression extends BaseCallExpression {
572
598
  +type: 'NewExpression';
573
599
  }
574
600
 
575
- interface BaseMemberExpressionWithComputedName extends BaseNode {
576
- +object: Expression | Super;
577
- +property: Expression;
578
- +computed: true;
579
- }
580
- interface BaseMemberExpressionWithNonComputedName extends BaseNode {
581
- +object: Expression | Super;
582
- +property: Identifier | PrivateName;
583
- +computed: false;
584
- }
585
601
  export type MemberExpression =
586
602
  | MemberExpressionWithComputedName
587
603
  | MemberExpressionWithNonComputedName;
588
- export interface MemberExpressionWithComputedName
589
- extends BaseMemberExpressionWithComputedName {
604
+ export interface MemberExpressionWithComputedName extends BaseNode {
590
605
  +type: 'MemberExpression';
591
606
  +computed: true;
607
+ +object: Expression | Super;
608
+ +property: Expression;
609
+ +computed: true;
610
+ +optional: boolean;
592
611
  }
593
- export interface MemberExpressionWithNonComputedName
594
- extends BaseMemberExpressionWithNonComputedName {
612
+ export interface MemberExpressionWithNonComputedName extends BaseNode {
595
613
  +type: 'MemberExpression';
596
614
  +computed: false;
615
+ +object: Expression | Super;
616
+ +property: Identifier | PrivateIdentifier;
617
+ +computed: false;
618
+ +optional: boolean;
597
619
  }
598
620
 
599
621
  export type ChainElement = CallExpression | MemberExpression;
@@ -624,6 +646,11 @@ export interface Identifier extends BaseNode {
624
646
  +optional: boolean;
625
647
  }
626
648
 
649
+ export interface PrivateIdentifier extends BaseNode {
650
+ +type: 'PrivateIdentifier';
651
+ +name: string;
652
+ }
653
+
627
654
  export type Literal =
628
655
  | BigIntLiteral
629
656
  | BooleanLiteral
@@ -688,7 +715,7 @@ export type UnaryOperator =
688
715
  | 'void'
689
716
  | 'delete';
690
717
 
691
- export type BinaryOperator =
718
+ export type BinaryOperatorWithoutIn =
692
719
  | '=='
693
720
  | '!='
694
721
  | '==='
@@ -709,9 +736,10 @@ export type BinaryOperator =
709
736
  | '|'
710
737
  | '^'
711
738
  | '&'
712
- | 'in'
713
739
  | 'instanceof';
714
740
 
741
+ export type BinaryOperator = BinaryOperatorWithoutIn | 'in';
742
+
715
743
  export type LogicalOperator = '||' | '&&' | '??';
716
744
 
717
745
  export type AssignmentOperator =
@@ -817,13 +845,18 @@ interface BaseClass extends BaseNode {
817
845
  +decorators: $ReadOnlyArray<Decorator>;
818
846
  }
819
847
 
820
- export type ClassMember =
821
- | ClassProperty
822
- | ClassPrivateProperty
823
- | MethodDefinition;
848
+ export type PropertyName =
849
+ | ClassPropertyNameComputed
850
+ | ClassPropertyNameNonComputed;
851
+ export type ClassPropertyNameComputed = Expression;
852
+ export type ClassPropertyNameNonComputed =
853
+ | PrivateIdentifier
854
+ | Identifier
855
+ | StringLiteral;
856
+
857
+ export type ClassMember = PropertyDefinition | MethodDefinition;
824
858
  export type ClassMemberWithNonComputedName =
825
- | ClassPropertyWithNonComputedName
826
- | ClassPrivateProperty
859
+ | PropertyDefinitionWithNonComputedName
827
860
  | MethodDefinitionConstructor
828
861
  | MethodDefinitionWithNonComputedName;
829
862
  export interface ClassBody extends BaseNode {
@@ -847,7 +880,7 @@ export interface MethodDefinitionConstructor extends MethodDefinitionBase {
847
880
  }
848
881
  export interface MethodDefinitionWithComputedName extends MethodDefinitionBase {
849
882
  +type: 'MethodDefinition';
850
- +key: Expression;
883
+ +key: ClassPropertyNameComputed;
851
884
  +kind: 'method' | 'get' | 'set';
852
885
  +computed: true;
853
886
  +static: boolean;
@@ -855,12 +888,38 @@ export interface MethodDefinitionWithComputedName extends MethodDefinitionBase {
855
888
  export interface MethodDefinitionWithNonComputedName
856
889
  extends MethodDefinitionBase {
857
890
  +type: 'MethodDefinition';
858
- +key: Identifier;
891
+ +key: ClassPropertyNameNonComputed;
859
892
  +kind: 'method' | 'get' | 'set';
860
893
  +computed: false;
861
894
  +static: boolean;
862
895
  }
863
896
 
897
+ // `PropertyDefinition` is the new standard for all class properties
898
+ export type PropertyDefinition =
899
+ | PropertyDefinitionWithComputedName
900
+ | PropertyDefinitionWithNonComputedName;
901
+ interface PropertyDefinitionBase extends BaseNode {
902
+ +value: null | Expression;
903
+ +typeAnnotation: null | TypeAnnotation;
904
+ +static: boolean;
905
+ +variance: null | Variance;
906
+ +declare: boolean;
907
+ // hermes always emit this as false
908
+ +optional: false;
909
+ }
910
+ export interface PropertyDefinitionWithComputedName
911
+ extends PropertyDefinitionBase {
912
+ +type: 'PropertyDefinition';
913
+ +key: ClassPropertyNameComputed;
914
+ +computed: true;
915
+ }
916
+ export interface PropertyDefinitionWithNonComputedName
917
+ extends PropertyDefinitionBase {
918
+ +type: 'PropertyDefinition';
919
+ +key: ClassPropertyNameNonComputed;
920
+ +computed: false;
921
+ }
922
+
864
923
  export interface ClassDeclaration extends BaseClass {
865
924
  +type: 'ClassDeclaration';
866
925
  /** It is null when a class declaration is a part of the `export default class` statement */
@@ -891,8 +950,7 @@ export type ModuleSpecifier =
891
950
  | ImportSpecifier
892
951
  | ImportDefaultSpecifier
893
952
  | ImportNamespaceSpecifier
894
- | ExportSpecifier
895
- | ExportNamespaceSpecifier;
953
+ | ExportSpecifier;
896
954
 
897
955
  export interface ImportDeclaration extends BaseNode {
898
956
  +type: 'ImportDeclaration';
@@ -933,10 +991,19 @@ export interface ImportNamespaceSpecifier extends BaseNode {
933
991
  +local: Identifier;
934
992
  }
935
993
 
994
+ export type DefaultDeclaration = FunctionDeclaration | ClassDeclaration;
995
+ export type NamedDeclaration =
996
+ | DefaultDeclaration
997
+ | VariableDeclaration
998
+ | TypeAlias
999
+ | OpaqueType
1000
+ | InterfaceDeclaration
1001
+ | EnumDeclaration;
1002
+
936
1003
  export interface ExportNamedDeclaration extends BaseNode {
937
1004
  +type: 'ExportNamedDeclaration';
938
- +declaration?: Declaration | null;
939
- +specifiers: $ReadOnlyArray<ExportSpecifier | ExportNamespaceSpecifier>;
1005
+ +declaration?: NamedDeclaration | null;
1006
+ +specifiers: $ReadOnlyArray<ExportSpecifier>;
940
1007
  +source?: Literal | null;
941
1008
  +exportKind: 'value' | 'type';
942
1009
  }
@@ -949,15 +1016,14 @@ export interface ExportSpecifier extends BaseNode {
949
1016
 
950
1017
  export interface ExportDefaultDeclaration extends BaseNode {
951
1018
  +type: 'ExportDefaultDeclaration';
952
- +declaration: Declaration | Expression;
1019
+ +declaration: DefaultDeclaration | Expression;
953
1020
  }
954
1021
 
955
1022
  export interface ExportAllDeclaration extends BaseNode {
956
1023
  +type: 'ExportAllDeclaration';
957
1024
  +source: Literal;
958
1025
  +exportKind: 'value' | 'type';
959
- // uncomment this when hermes stops using ExportNamespaceSpecifier
960
- // +exported: Identifier;
1026
+ +exported?: Identifier | null;
961
1027
  }
962
1028
 
963
1029
  export interface AwaitExpression extends BaseNode {
@@ -1379,7 +1445,7 @@ export interface DeclareExportDeclaration extends BaseNode {
1379
1445
  +type: 'DeclareExportDeclaration';
1380
1446
  +specifiers: $ReadOnlyArray<ExportSpecifier>;
1381
1447
  +declaration:
1382
- | TypeAnnotationType
1448
+ | TypeAlias
1383
1449
  | DeclareClass
1384
1450
  | DeclareFunction
1385
1451
  | DeclareOpaqueType
@@ -1518,67 +1584,4 @@ export interface JSXSpreadChild extends BaseNode {
1518
1584
  * Deprecated spec nodes awaiting migration by Hermes *
1519
1585
  ******************************************************/
1520
1586
 
1521
- // `ChainExpression` is the new standard for optional chaining
1522
- export interface OptionalCallExpression extends BaseCallExpression {
1523
- +type: 'OptionalCallExpression';
1524
- +optional: boolean;
1525
- }
1526
- export type OptionalMemberExpression =
1527
- | OptionalMemberExpressionWithComputedName
1528
- | OptionalMemberExpressionWithNonComputedName;
1529
- export interface OptionalMemberExpressionWithComputedName
1530
- extends BaseMemberExpressionWithComputedName {
1531
- +type: 'OptionalMemberExpression';
1532
- +optional: boolean;
1533
- +computed: true;
1534
- }
1535
- export interface OptionalMemberExpressionWithNonComputedName
1536
- extends BaseMemberExpressionWithNonComputedName {
1537
- +type: 'OptionalMemberExpression';
1538
- +optional: boolean;
1539
- +computed: false;
1540
- }
1541
-
1542
- // `ExportAllDeclaration` is the new standard for `export * as y from 'z'`
1543
- export interface ExportNamespaceSpecifier extends BaseNode {
1544
- +type: 'ExportNamespaceSpecifier';
1545
- +exported: Identifier;
1546
- }
1547
-
1548
- // `PropertyDefinition` is the new standard for all class properties
1549
- export type ClassProperty =
1550
- | ClassPropertyWithComputedName
1551
- | ClassPropertyWithNonComputedName;
1552
- interface ClassPropertyBase extends BaseNode {
1553
- +value: null | Expression;
1554
- +typeAnnotation: null | TypeAnnotationType;
1555
- +static: boolean;
1556
- +variance: null | Variance;
1557
- +declare: boolean;
1558
- // hermes always emit this as false
1559
- +optional: false;
1560
- }
1561
- export interface ClassPropertyWithComputedName extends ClassPropertyBase {
1562
- +type: 'ClassProperty';
1563
- +key: Expression;
1564
- +computed: true;
1565
- }
1566
- export interface ClassPropertyWithNonComputedName extends ClassPropertyBase {
1567
- +type: 'ClassProperty';
1568
- +key: Identifier;
1569
- +computed: false;
1570
- }
1571
- export interface ClassPrivateProperty extends ClassPropertyBase {
1572
- +type: 'ClassPrivateProperty';
1573
- +key: Identifier;
1574
- // this is never emitted, but it makes it easier to do lookups with the `ClassMember` type
1575
- +computed?: void;
1576
- }
1577
-
1578
- // `PrivateIdentifier` is the new standard for #private identifiers
1579
- export interface PrivateName extends BaseNode {
1580
- +type: 'PrivateName';
1581
- +id: Identifier;
1582
- }
1583
-
1584
1587
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hermes-estree",
3
- "version": "0.7.0",
3
+ "version": "0.8.0",
4
4
  "description": "Flow types for the Flow-ESTree spec produced by the hermes parser",
5
5
  "main": "dist/index.js",
6
6
  "license": "MIT",