hermes-estree 0.15.1 → 0.16.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.
@@ -175,6 +175,7 @@ import type {
175
175
  TypeAnnotation,
176
176
  TypeCastExpression,
177
177
  TypeofTypeAnnotation,
178
+ TypeOperator,
178
179
  TypeParameter,
179
180
  TypeParameterDeclaration,
180
181
  TypeParameterInstantiation,
@@ -1312,6 +1313,12 @@ interface TypeCastExpression_With_typeAnnotation extends TypeCastExpression {
1312
1313
  interface TypeofTypeAnnotation_With_argument extends TypeofTypeAnnotation {
1313
1314
  +argument: $NonMaybeType<TypeofTypeAnnotation['argument']>;
1314
1315
  }
1316
+ interface TypeOperator_With_operator extends TypeOperator {
1317
+ +operator: $NonMaybeType<TypeOperator['operator']>;
1318
+ }
1319
+ interface TypeOperator_With_typeAnnotation extends TypeOperator {
1320
+ +typeAnnotation: $NonMaybeType<TypeOperator['typeAnnotation']>;
1321
+ }
1315
1322
  interface TypeParameter_With_name extends TypeParameter {
1316
1323
  +name: $NonMaybeType<TypeParameter['name']>;
1317
1324
  }
@@ -2375,6 +2382,11 @@ export type ESQueryNodeSelectorsWithoutFallback = {
2375
2382
  +'TypeofTypeAnnotation[argument]'?: (
2376
2383
  node: TypeofTypeAnnotation_With_argument,
2377
2384
  ) => void,
2385
+ +TypeOperator?: (node: TypeOperator) => void,
2386
+ +'TypeOperator[operator]'?: (node: TypeOperator_With_operator) => void,
2387
+ +'TypeOperator[typeAnnotation]'?: (
2388
+ node: TypeOperator_With_typeAnnotation,
2389
+ ) => void,
2378
2390
  +TypeParameter?: (node: TypeParameter) => void,
2379
2391
  +'TypeParameter[name]'?: (node: TypeParameter_With_name) => void,
2380
2392
  +'TypeParameter[bound]'?: (node: TypeParameter_With_bound) => void,
@@ -3436,6 +3448,11 @@ export type ESQueryNodeSelectorsWithoutFallback = {
3436
3448
  +'TypeofTypeAnnotation[argument]:exit'?: (
3437
3449
  node: TypeofTypeAnnotation_With_argument,
3438
3450
  ) => void,
3451
+ +'TypeOperator:exit'?: (node: TypeOperator) => void,
3452
+ +'TypeOperator[operator]:exit'?: (node: TypeOperator_With_operator) => void,
3453
+ +'TypeOperator[typeAnnotation]:exit'?: (
3454
+ node: TypeOperator_With_typeAnnotation,
3455
+ ) => void,
3439
3456
  +'TypeParameter:exit'?: (node: TypeParameter) => void,
3440
3457
  +'TypeParameter[name]:exit'?: (node: TypeParameter_With_name) => void,
3441
3458
  +'TypeParameter[bound]:exit'?: (node: TypeParameter_With_bound) => void,
@@ -276,6 +276,7 @@ exports.isTypeAnnotation = isTypeAnnotation;
276
276
  exports.isTypeCastExpression = isTypeCastExpression;
277
277
  exports.isTypeKeyword = isTypeKeyword;
278
278
  exports.isTypeOfToken = isTypeOfToken;
279
+ exports.isTypeOperator = isTypeOperator;
279
280
  exports.isTypeParameter = isTypeParameter;
280
281
  exports.isTypeParameterDeclaration = isTypeParameterDeclaration;
281
282
  exports.isTypeParameterInstantiation = isTypeParameterInstantiation;
@@ -903,6 +904,10 @@ function isTypeofTypeAnnotation(node) {
903
904
  return node.type === 'TypeofTypeAnnotation';
904
905
  }
905
906
 
907
+ function isTypeOperator(node) {
908
+ return node.type === 'TypeOperator';
909
+ }
910
+
906
911
  function isTypeParameter(node) {
907
912
  return node.type === 'TypeParameter';
908
913
  }
@@ -687,6 +687,10 @@ export function isTypeofTypeAnnotation(node: ESNode | Token): boolean %checks {
687
687
  return node.type === 'TypeofTypeAnnotation';
688
688
  }
689
689
 
690
+ export function isTypeOperator(node: ESNode | Token): boolean %checks {
691
+ return node.type === 'TypeOperator';
692
+ }
693
+
690
694
  export function isTypeParameter(node: ESNode | Token): boolean %checks {
691
695
  return node.type === 'TypeParameter';
692
696
  }
@@ -544,8 +544,8 @@ export interface DestructuringObjectPropertyWithShorthandStaticName
544
544
  +computed: false;
545
545
  // shorthand keys *must* be identifiers
546
546
  +key: Identifier;
547
- // shorthand values *must* be identifiers (that look the same as the key)
548
- +value: Identifier;
547
+ // shorthand values *must* be identifiers or assignments (that look the same as the key)
548
+ +value: Identifier | AssignmentPattern;
549
549
  +shorthand: true;
550
550
  }
551
551
  export interface DestructuringObjectPropertyWithComputedName
@@ -700,7 +700,7 @@ export type Literal =
700
700
 
701
701
  export interface BigIntLiteral extends BaseNode {
702
702
  +type: 'Literal';
703
- +value: null /* | bigint */;
703
+ +value: bigint;
704
704
  +bigint: string;
705
705
  +raw: string;
706
706
  +literalType: 'bigint';
@@ -1067,7 +1067,7 @@ export interface ExportNamedDeclarationWithSpecifiers
1067
1067
  extends ExportNamedDeclarationBase {
1068
1068
  +type: 'ExportNamedDeclaration';
1069
1069
  +declaration: null;
1070
- +source: null;
1070
+ +source?: StringLiteral | null;
1071
1071
  +specifiers: $ReadOnlyArray<ExportSpecifier>;
1072
1072
  }
1073
1073
  export interface ExportNamedDeclarationWithDeclaration
@@ -1140,6 +1140,7 @@ export type TypeAnnotationType =
1140
1140
  | UnionTypeAnnotation
1141
1141
  | IntersectionTypeAnnotation
1142
1142
  | ConditionalTypeAnnotation
1143
+ | TypeOperator
1143
1144
  | TypePredicate
1144
1145
  | FunctionTypeAnnotation
1145
1146
  | ComponentTypeAnnotation
@@ -1223,7 +1224,7 @@ export interface NumberLiteralTypeAnnotation extends BaseNode {
1223
1224
  export interface BigIntLiteralTypeAnnotation extends BaseNode {
1224
1225
  +type: 'BigIntLiteralTypeAnnotation';
1225
1226
  +bigint: string;
1226
- +value: null /* | bigint */;
1227
+ +value: bigint;
1227
1228
  +raw: string;
1228
1229
  }
1229
1230
  export interface BooleanLiteralTypeAnnotation extends BaseNode {
@@ -1320,6 +1321,13 @@ export interface ConditionalTypeAnnotation extends BaseNode {
1320
1321
  +falseType: TypeAnnotationType;
1321
1322
  }
1322
1323
 
1324
+ export interface TypeOperator extends BaseNode {
1325
+ +type: 'TypeOperator';
1326
+ // Supported type operators, currently only "renders".
1327
+ +operator: 'renders';
1328
+ +typeAnnotation: TypeAnnotationType;
1329
+ }
1330
+
1323
1331
  export interface TypePredicate extends BaseNode {
1324
1332
  +type: 'TypePredicate';
1325
1333
  +parameterName: Identifier;
@@ -1368,7 +1376,7 @@ export interface InferredPredicate extends BaseNode {
1368
1376
 
1369
1377
  export interface ObjectTypeAnnotation extends BaseNode {
1370
1378
  +type: 'ObjectTypeAnnotation';
1371
- +inexact: false;
1379
+ +inexact: boolean;
1372
1380
  +exact: boolean;
1373
1381
  +properties: $ReadOnlyArray<
1374
1382
  | ObjectTypeProperty
@@ -1707,7 +1715,11 @@ interface DeclareExportDeclarationBase extends BaseNode {
1707
1715
  export interface DeclareExportDefaultDeclaration
1708
1716
  extends DeclareExportDeclarationBase {
1709
1717
  +type: 'DeclareExportDeclaration';
1710
- +declaration: DeclareClass | DeclareFunction | TypeAnnotationType;
1718
+ +declaration:
1719
+ | DeclareClass
1720
+ | DeclareFunction
1721
+ | DeclareComponent
1722
+ | TypeAnnotationType;
1711
1723
  +default: true;
1712
1724
  // default cannot have a source
1713
1725
  +source: null;
@@ -1720,6 +1732,7 @@ export interface DeclareExportDeclarationNamedWithDeclaration
1720
1732
  +declaration:
1721
1733
  | DeclareClass
1722
1734
  | DeclareFunction
1735
+ | DeclareComponent
1723
1736
  | DeclareInterface
1724
1737
  | DeclareOpaqueType
1725
1738
  | DeclareVariable
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hermes-estree",
3
- "version": "0.15.1",
3
+ "version": "0.16.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",