hermes-estree 0.18.2 → 0.19.1
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.
|
@@ -61,9 +61,11 @@ import type {
|
|
|
61
61
|
DeclareExportAllDeclaration,
|
|
62
62
|
DeclareExportDeclaration,
|
|
63
63
|
DeclareFunction,
|
|
64
|
+
DeclareHook,
|
|
64
65
|
DeclareInterface,
|
|
65
66
|
DeclareModule,
|
|
66
67
|
DeclareModuleExports,
|
|
68
|
+
DeclareNamespace,
|
|
67
69
|
DeclareOpaqueType,
|
|
68
70
|
DeclareTypeAlias,
|
|
69
71
|
DeclareVariable,
|
|
@@ -93,6 +95,8 @@ import type {
|
|
|
93
95
|
FunctionTypeAnnotation,
|
|
94
96
|
FunctionTypeParam,
|
|
95
97
|
GenericTypeAnnotation,
|
|
98
|
+
HookDeclaration,
|
|
99
|
+
HookTypeAnnotation,
|
|
96
100
|
Identifier,
|
|
97
101
|
IfStatement,
|
|
98
102
|
ImportAttribute,
|
|
@@ -502,6 +506,9 @@ interface DeclareFunction_With_id extends DeclareFunction {
|
|
|
502
506
|
interface DeclareFunction_With_predicate extends DeclareFunction {
|
|
503
507
|
+predicate: $NonMaybeType<DeclareFunction['predicate']>;
|
|
504
508
|
}
|
|
509
|
+
interface DeclareHook_With_id extends DeclareHook {
|
|
510
|
+
+id: $NonMaybeType<DeclareHook['id']>;
|
|
511
|
+
}
|
|
505
512
|
interface DeclareInterface_With_id extends DeclareInterface {
|
|
506
513
|
+id: $NonMaybeType<DeclareInterface['id']>;
|
|
507
514
|
}
|
|
@@ -520,13 +527,16 @@ interface DeclareModule_With_id extends DeclareModule {
|
|
|
520
527
|
interface DeclareModule_With_body extends DeclareModule {
|
|
521
528
|
+body: $NonMaybeType<DeclareModule['body']>;
|
|
522
529
|
}
|
|
523
|
-
interface DeclareModule_With_kind extends DeclareModule {
|
|
524
|
-
+kind: $NonMaybeType<DeclareModule['kind']>;
|
|
525
|
-
}
|
|
526
530
|
interface DeclareModuleExports_With_typeAnnotation
|
|
527
531
|
extends DeclareModuleExports {
|
|
528
532
|
+typeAnnotation: $NonMaybeType<DeclareModuleExports['typeAnnotation']>;
|
|
529
533
|
}
|
|
534
|
+
interface DeclareNamespace_With_id extends DeclareNamespace {
|
|
535
|
+
+id: $NonMaybeType<DeclareNamespace['id']>;
|
|
536
|
+
}
|
|
537
|
+
interface DeclareNamespace_With_body extends DeclareNamespace {
|
|
538
|
+
+body: $NonMaybeType<DeclareNamespace['body']>;
|
|
539
|
+
}
|
|
530
540
|
interface DeclareOpaqueType_With_id extends DeclareOpaqueType {
|
|
531
541
|
+id: $NonMaybeType<DeclareOpaqueType['id']>;
|
|
532
542
|
}
|
|
@@ -774,6 +784,33 @@ interface GenericTypeAnnotation_With_typeParameters
|
|
|
774
784
|
extends GenericTypeAnnotation {
|
|
775
785
|
+typeParameters: $NonMaybeType<GenericTypeAnnotation['typeParameters']>;
|
|
776
786
|
}
|
|
787
|
+
interface HookDeclaration_With_id extends HookDeclaration {
|
|
788
|
+
+id: $NonMaybeType<HookDeclaration['id']>;
|
|
789
|
+
}
|
|
790
|
+
interface HookDeclaration_With_params extends HookDeclaration {
|
|
791
|
+
+params: $NonMaybeType<HookDeclaration['params']>;
|
|
792
|
+
}
|
|
793
|
+
interface HookDeclaration_With_body extends HookDeclaration {
|
|
794
|
+
+body: $NonMaybeType<HookDeclaration['body']>;
|
|
795
|
+
}
|
|
796
|
+
interface HookDeclaration_With_typeParameters extends HookDeclaration {
|
|
797
|
+
+typeParameters: $NonMaybeType<HookDeclaration['typeParameters']>;
|
|
798
|
+
}
|
|
799
|
+
interface HookDeclaration_With_returnType extends HookDeclaration {
|
|
800
|
+
+returnType: $NonMaybeType<HookDeclaration['returnType']>;
|
|
801
|
+
}
|
|
802
|
+
interface HookTypeAnnotation_With_params extends HookTypeAnnotation {
|
|
803
|
+
+params: $NonMaybeType<HookTypeAnnotation['params']>;
|
|
804
|
+
}
|
|
805
|
+
interface HookTypeAnnotation_With_returnType extends HookTypeAnnotation {
|
|
806
|
+
+returnType: $NonMaybeType<HookTypeAnnotation['returnType']>;
|
|
807
|
+
}
|
|
808
|
+
interface HookTypeAnnotation_With_rest extends HookTypeAnnotation {
|
|
809
|
+
+rest: $NonMaybeType<HookTypeAnnotation['rest']>;
|
|
810
|
+
}
|
|
811
|
+
interface HookTypeAnnotation_With_typeParameters extends HookTypeAnnotation {
|
|
812
|
+
+typeParameters: $NonMaybeType<HookTypeAnnotation['typeParameters']>;
|
|
813
|
+
}
|
|
777
814
|
interface Identifier_With_name extends Identifier {
|
|
778
815
|
+name: $NonMaybeType<Identifier['name']>;
|
|
779
816
|
}
|
|
@@ -1320,6 +1357,9 @@ interface TypeCastExpression_With_typeAnnotation extends TypeCastExpression {
|
|
|
1320
1357
|
interface TypeofTypeAnnotation_With_argument extends TypeofTypeAnnotation {
|
|
1321
1358
|
+argument: $NonMaybeType<TypeofTypeAnnotation['argument']>;
|
|
1322
1359
|
}
|
|
1360
|
+
interface TypeofTypeAnnotation_With_typeArguments extends TypeofTypeAnnotation {
|
|
1361
|
+
+typeArguments: $NonMaybeType<TypeofTypeAnnotation['typeArguments']>;
|
|
1362
|
+
}
|
|
1323
1363
|
interface TypeOperator_With_operator extends TypeOperator {
|
|
1324
1364
|
+operator: $NonMaybeType<TypeOperator['operator']>;
|
|
1325
1365
|
}
|
|
@@ -1442,6 +1482,7 @@ type DeclarationSpecialSelector =
|
|
|
1442
1482
|
| ExportDefaultDeclaration
|
|
1443
1483
|
| ExportNamedDeclaration
|
|
1444
1484
|
| FunctionDeclaration
|
|
1485
|
+
| HookDeclaration
|
|
1445
1486
|
| ImportDeclaration
|
|
1446
1487
|
| InterfaceDeclaration
|
|
1447
1488
|
| TypeParameterDeclaration
|
|
@@ -1736,6 +1777,8 @@ export type ESQueryNodeSelectorsWithoutFallback = {
|
|
|
1736
1777
|
+'DeclareFunction[predicate]'?: (
|
|
1737
1778
|
node: DeclareFunction_With_predicate,
|
|
1738
1779
|
) => void,
|
|
1780
|
+
+DeclareHook?: (node: DeclareHook) => void,
|
|
1781
|
+
+'DeclareHook[id]'?: (node: DeclareHook_With_id) => void,
|
|
1739
1782
|
+DeclareInterface?: (node: DeclareInterface) => void,
|
|
1740
1783
|
+'DeclareInterface[id]'?: (node: DeclareInterface_With_id) => void,
|
|
1741
1784
|
+'DeclareInterface[typeParameters]'?: (
|
|
@@ -1746,11 +1789,13 @@ export type ESQueryNodeSelectorsWithoutFallback = {
|
|
|
1746
1789
|
+DeclareModule?: (node: DeclareModule) => void,
|
|
1747
1790
|
+'DeclareModule[id]'?: (node: DeclareModule_With_id) => void,
|
|
1748
1791
|
+'DeclareModule[body]'?: (node: DeclareModule_With_body) => void,
|
|
1749
|
-
+'DeclareModule[kind]'?: (node: DeclareModule_With_kind) => void,
|
|
1750
1792
|
+DeclareModuleExports?: (node: DeclareModuleExports) => void,
|
|
1751
1793
|
+'DeclareModuleExports[typeAnnotation]'?: (
|
|
1752
1794
|
node: DeclareModuleExports_With_typeAnnotation,
|
|
1753
1795
|
) => void,
|
|
1796
|
+
+DeclareNamespace?: (node: DeclareNamespace) => void,
|
|
1797
|
+
+'DeclareNamespace[id]'?: (node: DeclareNamespace_With_id) => void,
|
|
1798
|
+
+'DeclareNamespace[body]'?: (node: DeclareNamespace_With_body) => void,
|
|
1754
1799
|
+DeclareOpaqueType?: (node: DeclareOpaqueType) => void,
|
|
1755
1800
|
+'DeclareOpaqueType[id]'?: (node: DeclareOpaqueType_With_id) => void,
|
|
1756
1801
|
+'DeclareOpaqueType[typeParameters]'?: (
|
|
@@ -1940,6 +1985,27 @@ export type ESQueryNodeSelectorsWithoutFallback = {
|
|
|
1940
1985
|
+'GenericTypeAnnotation[typeParameters]'?: (
|
|
1941
1986
|
node: GenericTypeAnnotation_With_typeParameters,
|
|
1942
1987
|
) => void,
|
|
1988
|
+
+HookDeclaration?: (node: HookDeclaration) => void,
|
|
1989
|
+
+'HookDeclaration[id]'?: (node: HookDeclaration_With_id) => void,
|
|
1990
|
+
+'HookDeclaration[params]'?: (node: HookDeclaration_With_params) => void,
|
|
1991
|
+
+'HookDeclaration[body]'?: (node: HookDeclaration_With_body) => void,
|
|
1992
|
+
+'HookDeclaration[typeParameters]'?: (
|
|
1993
|
+
node: HookDeclaration_With_typeParameters,
|
|
1994
|
+
) => void,
|
|
1995
|
+
+'HookDeclaration[returnType]'?: (
|
|
1996
|
+
node: HookDeclaration_With_returnType,
|
|
1997
|
+
) => void,
|
|
1998
|
+
+HookTypeAnnotation?: (node: HookTypeAnnotation) => void,
|
|
1999
|
+
+'HookTypeAnnotation[params]'?: (
|
|
2000
|
+
node: HookTypeAnnotation_With_params,
|
|
2001
|
+
) => void,
|
|
2002
|
+
+'HookTypeAnnotation[returnType]'?: (
|
|
2003
|
+
node: HookTypeAnnotation_With_returnType,
|
|
2004
|
+
) => void,
|
|
2005
|
+
+'HookTypeAnnotation[rest]'?: (node: HookTypeAnnotation_With_rest) => void,
|
|
2006
|
+
+'HookTypeAnnotation[typeParameters]'?: (
|
|
2007
|
+
node: HookTypeAnnotation_With_typeParameters,
|
|
2008
|
+
) => void,
|
|
1943
2009
|
+Identifier?: (node: Identifier) => void,
|
|
1944
2010
|
+'Identifier[name]'?: (node: Identifier_With_name) => void,
|
|
1945
2011
|
+'Identifier[typeAnnotation]'?: (
|
|
@@ -2395,6 +2461,9 @@ export type ESQueryNodeSelectorsWithoutFallback = {
|
|
|
2395
2461
|
+'TypeofTypeAnnotation[argument]'?: (
|
|
2396
2462
|
node: TypeofTypeAnnotation_With_argument,
|
|
2397
2463
|
) => void,
|
|
2464
|
+
+'TypeofTypeAnnotation[typeArguments]'?: (
|
|
2465
|
+
node: TypeofTypeAnnotation_With_typeArguments,
|
|
2466
|
+
) => void,
|
|
2398
2467
|
+TypeOperator?: (node: TypeOperator) => void,
|
|
2399
2468
|
+'TypeOperator[operator]'?: (node: TypeOperator_With_operator) => void,
|
|
2400
2469
|
+'TypeOperator[typeAnnotation]'?: (
|
|
@@ -2751,6 +2820,8 @@ export type ESQueryNodeSelectorsWithoutFallback = {
|
|
|
2751
2820
|
+'DeclareFunction[predicate]:exit'?: (
|
|
2752
2821
|
node: DeclareFunction_With_predicate,
|
|
2753
2822
|
) => void,
|
|
2823
|
+
+'DeclareHook:exit'?: (node: DeclareHook) => void,
|
|
2824
|
+
+'DeclareHook[id]:exit'?: (node: DeclareHook_With_id) => void,
|
|
2754
2825
|
+'DeclareInterface:exit'?: (node: DeclareInterface) => void,
|
|
2755
2826
|
+'DeclareInterface[id]:exit'?: (node: DeclareInterface_With_id) => void,
|
|
2756
2827
|
+'DeclareInterface[typeParameters]:exit'?: (
|
|
@@ -2763,11 +2834,13 @@ export type ESQueryNodeSelectorsWithoutFallback = {
|
|
|
2763
2834
|
+'DeclareModule:exit'?: (node: DeclareModule) => void,
|
|
2764
2835
|
+'DeclareModule[id]:exit'?: (node: DeclareModule_With_id) => void,
|
|
2765
2836
|
+'DeclareModule[body]:exit'?: (node: DeclareModule_With_body) => void,
|
|
2766
|
-
+'DeclareModule[kind]:exit'?: (node: DeclareModule_With_kind) => void,
|
|
2767
2837
|
+'DeclareModuleExports:exit'?: (node: DeclareModuleExports) => void,
|
|
2768
2838
|
+'DeclareModuleExports[typeAnnotation]:exit'?: (
|
|
2769
2839
|
node: DeclareModuleExports_With_typeAnnotation,
|
|
2770
2840
|
) => void,
|
|
2841
|
+
+'DeclareNamespace:exit'?: (node: DeclareNamespace) => void,
|
|
2842
|
+
+'DeclareNamespace[id]:exit'?: (node: DeclareNamespace_With_id) => void,
|
|
2843
|
+
+'DeclareNamespace[body]:exit'?: (node: DeclareNamespace_With_body) => void,
|
|
2771
2844
|
+'DeclareOpaqueType:exit'?: (node: DeclareOpaqueType) => void,
|
|
2772
2845
|
+'DeclareOpaqueType[id]:exit'?: (node: DeclareOpaqueType_With_id) => void,
|
|
2773
2846
|
+'DeclareOpaqueType[typeParameters]:exit'?: (
|
|
@@ -2969,6 +3042,29 @@ export type ESQueryNodeSelectorsWithoutFallback = {
|
|
|
2969
3042
|
+'GenericTypeAnnotation[typeParameters]:exit'?: (
|
|
2970
3043
|
node: GenericTypeAnnotation_With_typeParameters,
|
|
2971
3044
|
) => void,
|
|
3045
|
+
+'HookDeclaration:exit'?: (node: HookDeclaration) => void,
|
|
3046
|
+
+'HookDeclaration[id]:exit'?: (node: HookDeclaration_With_id) => void,
|
|
3047
|
+
+'HookDeclaration[params]:exit'?: (node: HookDeclaration_With_params) => void,
|
|
3048
|
+
+'HookDeclaration[body]:exit'?: (node: HookDeclaration_With_body) => void,
|
|
3049
|
+
+'HookDeclaration[typeParameters]:exit'?: (
|
|
3050
|
+
node: HookDeclaration_With_typeParameters,
|
|
3051
|
+
) => void,
|
|
3052
|
+
+'HookDeclaration[returnType]:exit'?: (
|
|
3053
|
+
node: HookDeclaration_With_returnType,
|
|
3054
|
+
) => void,
|
|
3055
|
+
+'HookTypeAnnotation:exit'?: (node: HookTypeAnnotation) => void,
|
|
3056
|
+
+'HookTypeAnnotation[params]:exit'?: (
|
|
3057
|
+
node: HookTypeAnnotation_With_params,
|
|
3058
|
+
) => void,
|
|
3059
|
+
+'HookTypeAnnotation[returnType]:exit'?: (
|
|
3060
|
+
node: HookTypeAnnotation_With_returnType,
|
|
3061
|
+
) => void,
|
|
3062
|
+
+'HookTypeAnnotation[rest]:exit'?: (
|
|
3063
|
+
node: HookTypeAnnotation_With_rest,
|
|
3064
|
+
) => void,
|
|
3065
|
+
+'HookTypeAnnotation[typeParameters]:exit'?: (
|
|
3066
|
+
node: HookTypeAnnotation_With_typeParameters,
|
|
3067
|
+
) => void,
|
|
2972
3068
|
+'Identifier:exit'?: (node: Identifier) => void,
|
|
2973
3069
|
+'Identifier[name]:exit'?: (node: Identifier_With_name) => void,
|
|
2974
3070
|
+'Identifier[typeAnnotation]:exit'?: (
|
|
@@ -3468,6 +3564,9 @@ export type ESQueryNodeSelectorsWithoutFallback = {
|
|
|
3468
3564
|
+'TypeofTypeAnnotation[argument]:exit'?: (
|
|
3469
3565
|
node: TypeofTypeAnnotation_With_argument,
|
|
3470
3566
|
) => void,
|
|
3567
|
+
+'TypeofTypeAnnotation[typeArguments]:exit'?: (
|
|
3568
|
+
node: TypeofTypeAnnotation_With_typeArguments,
|
|
3569
|
+
) => void,
|
|
3471
3570
|
+'TypeOperator:exit'?: (node: TypeOperator) => void,
|
|
3472
3571
|
+'TypeOperator[operator]:exit'?: (node: TypeOperator_With_operator) => void,
|
|
3473
3572
|
+'TypeOperator[typeAnnotation]:exit'?: (
|
|
@@ -64,9 +64,11 @@ import type {
|
|
|
64
64
|
DeclareExportAllDeclaration,
|
|
65
65
|
DeclareExportDeclaration,
|
|
66
66
|
DeclareFunction,
|
|
67
|
+
DeclareHook,
|
|
67
68
|
DeclareInterface,
|
|
68
69
|
DeclareModule,
|
|
69
70
|
DeclareModuleExports,
|
|
71
|
+
DeclareNamespace,
|
|
70
72
|
DeclareOpaqueType,
|
|
71
73
|
DeclareTypeAlias,
|
|
72
74
|
DeclareVariable,
|
|
@@ -96,6 +98,8 @@ import type {
|
|
|
96
98
|
FunctionTypeAnnotation,
|
|
97
99
|
FunctionTypeParam,
|
|
98
100
|
GenericTypeAnnotation,
|
|
101
|
+
HookDeclaration,
|
|
102
|
+
HookTypeAnnotation,
|
|
99
103
|
IfStatement,
|
|
100
104
|
ImportAttribute,
|
|
101
105
|
ImportDeclaration,
|
|
@@ -266,10 +270,12 @@ exports.isDeclareEnum = isDeclareEnum;
|
|
|
266
270
|
exports.isDeclareExportAllDeclaration = isDeclareExportAllDeclaration;
|
|
267
271
|
exports.isDeclareExportDeclaration = isDeclareExportDeclaration;
|
|
268
272
|
exports.isDeclareFunction = isDeclareFunction;
|
|
273
|
+
exports.isDeclareHook = isDeclareHook;
|
|
269
274
|
exports.isDeclareInterface = isDeclareInterface;
|
|
270
275
|
exports.isDeclareKeyword = isDeclareKeyword;
|
|
271
276
|
exports.isDeclareModule = isDeclareModule;
|
|
272
277
|
exports.isDeclareModuleExports = isDeclareModuleExports;
|
|
278
|
+
exports.isDeclareNamespace = isDeclareNamespace;
|
|
273
279
|
exports.isDeclareOpaqueType = isDeclareOpaqueType;
|
|
274
280
|
exports.isDeclareTypeAlias = isDeclareTypeAlias;
|
|
275
281
|
exports.isDeclareVariable = isDeclareVariable;
|
|
@@ -322,6 +328,8 @@ exports.isGenericTypeAnnotation = isGenericTypeAnnotation;
|
|
|
322
328
|
exports.isGetKeyword = isGetKeyword;
|
|
323
329
|
exports.isGreaterThanOrEqualToToken = isGreaterThanOrEqualToToken;
|
|
324
330
|
exports.isGreaterThanToken = isGreaterThanToken;
|
|
331
|
+
exports.isHookDeclaration = isHookDeclaration;
|
|
332
|
+
exports.isHookTypeAnnotation = isHookTypeAnnotation;
|
|
325
333
|
exports.isIdentifier = isIdentifier;
|
|
326
334
|
exports.isIfStatement = isIfStatement;
|
|
327
335
|
exports.isIfToken = isIfToken;
|
|
@@ -805,6 +813,14 @@ function isDeclareFunction(node
|
|
|
805
813
|
return node.type === 'DeclareFunction';
|
|
806
814
|
}
|
|
807
815
|
|
|
816
|
+
function isDeclareHook(node
|
|
817
|
+
/*: ESNode | Token */
|
|
818
|
+
)
|
|
819
|
+
/*: node is DeclareHook */
|
|
820
|
+
{
|
|
821
|
+
return node.type === 'DeclareHook';
|
|
822
|
+
}
|
|
823
|
+
|
|
808
824
|
function isDeclareInterface(node
|
|
809
825
|
/*: ESNode | Token */
|
|
810
826
|
)
|
|
@@ -829,6 +845,14 @@ function isDeclareModuleExports(node
|
|
|
829
845
|
return node.type === 'DeclareModuleExports';
|
|
830
846
|
}
|
|
831
847
|
|
|
848
|
+
function isDeclareNamespace(node
|
|
849
|
+
/*: ESNode | Token */
|
|
850
|
+
)
|
|
851
|
+
/*: node is DeclareNamespace */
|
|
852
|
+
{
|
|
853
|
+
return node.type === 'DeclareNamespace';
|
|
854
|
+
}
|
|
855
|
+
|
|
832
856
|
function isDeclareOpaqueType(node
|
|
833
857
|
/*: ESNode | Token */
|
|
834
858
|
)
|
|
@@ -1061,6 +1085,22 @@ function isGenericTypeAnnotation(node
|
|
|
1061
1085
|
return node.type === 'GenericTypeAnnotation';
|
|
1062
1086
|
}
|
|
1063
1087
|
|
|
1088
|
+
function isHookDeclaration(node
|
|
1089
|
+
/*: ESNode | Token */
|
|
1090
|
+
)
|
|
1091
|
+
/*: node is HookDeclaration */
|
|
1092
|
+
{
|
|
1093
|
+
return node.type === 'HookDeclaration';
|
|
1094
|
+
}
|
|
1095
|
+
|
|
1096
|
+
function isHookTypeAnnotation(node
|
|
1097
|
+
/*: ESNode | Token */
|
|
1098
|
+
)
|
|
1099
|
+
/*: node is HookTypeAnnotation */
|
|
1100
|
+
{
|
|
1101
|
+
return node.type === 'HookTypeAnnotation';
|
|
1102
|
+
}
|
|
1103
|
+
|
|
1064
1104
|
function isIfStatement(node
|
|
1065
1105
|
/*: ESNode | Token */
|
|
1066
1106
|
)
|
|
@@ -65,9 +65,11 @@ import type {
|
|
|
65
65
|
DeclareExportAllDeclaration,
|
|
66
66
|
DeclareExportDeclaration,
|
|
67
67
|
DeclareFunction,
|
|
68
|
+
DeclareHook,
|
|
68
69
|
DeclareInterface,
|
|
69
70
|
DeclareModule,
|
|
70
71
|
DeclareModuleExports,
|
|
72
|
+
DeclareNamespace,
|
|
71
73
|
DeclareOpaqueType,
|
|
72
74
|
DeclareTypeAlias,
|
|
73
75
|
DeclareVariable,
|
|
@@ -97,6 +99,8 @@ import type {
|
|
|
97
99
|
FunctionTypeAnnotation,
|
|
98
100
|
FunctionTypeParam,
|
|
99
101
|
GenericTypeAnnotation,
|
|
102
|
+
HookDeclaration,
|
|
103
|
+
HookTypeAnnotation,
|
|
100
104
|
IfStatement,
|
|
101
105
|
ImportAttribute,
|
|
102
106
|
ImportDeclaration,
|
|
@@ -404,6 +408,11 @@ export function isDeclareFunction(node /*: ESNode | Token */) /*: node is Declar
|
|
|
404
408
|
}
|
|
405
409
|
|
|
406
410
|
|
|
411
|
+
export function isDeclareHook(node /*: ESNode | Token */) /*: node is DeclareHook */ {
|
|
412
|
+
return node.type === 'DeclareHook';
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
|
|
407
416
|
export function isDeclareInterface(node /*: ESNode | Token */) /*: node is DeclareInterface */ {
|
|
408
417
|
return node.type === 'DeclareInterface';
|
|
409
418
|
}
|
|
@@ -419,6 +428,11 @@ export function isDeclareModuleExports(node /*: ESNode | Token */) /*: node is D
|
|
|
419
428
|
}
|
|
420
429
|
|
|
421
430
|
|
|
431
|
+
export function isDeclareNamespace(node /*: ESNode | Token */) /*: node is DeclareNamespace */ {
|
|
432
|
+
return node.type === 'DeclareNamespace';
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
|
|
422
436
|
export function isDeclareOpaqueType(node /*: ESNode | Token */) /*: node is DeclareOpaqueType */ {
|
|
423
437
|
return node.type === 'DeclareOpaqueType';
|
|
424
438
|
}
|
|
@@ -564,6 +578,16 @@ export function isGenericTypeAnnotation(node /*: ESNode | Token */) /*: node is
|
|
|
564
578
|
}
|
|
565
579
|
|
|
566
580
|
|
|
581
|
+
export function isHookDeclaration(node /*: ESNode | Token */) /*: node is HookDeclaration */ {
|
|
582
|
+
return node.type === 'HookDeclaration';
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
|
|
586
|
+
export function isHookTypeAnnotation(node /*: ESNode | Token */) /*: node is HookTypeAnnotation */ {
|
|
587
|
+
return node.type === 'HookTypeAnnotation';
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
|
|
567
591
|
export function isIfStatement(node /*: ESNode | Token */) /*: node is IfStatement */ {
|
|
568
592
|
return node.type === 'IfStatement';
|
|
569
593
|
}
|
package/dist/predicates.js
CHANGED
|
@@ -149,7 +149,7 @@ function isStringLiteral(node) {
|
|
|
149
149
|
|
|
150
150
|
|
|
151
151
|
function isExpression(node) {
|
|
152
|
-
return (0, _predicates.isThisExpression)(node) || (0, _predicates.isArrayExpression)(node) || (0, _predicates.isObjectExpression)(node) || (0, _predicates.isFunctionExpression)(node) || (0, _predicates.isArrowFunctionExpression)(node) || (0, _predicates.isYieldExpression)(node) || (0, _predicates.isLiteral)(node) || (0, _predicates.isUnaryExpression)(node) || (0, _predicates.isUpdateExpression)(node) || (0, _predicates.isBinaryExpression)(node) || (0, _predicates.isAssignmentExpression)(node) || (0, _predicates.isLogicalExpression)(node) || (0, _predicates.isMemberExpression)(node) || (0, _predicates.isConditionalExpression)(node) || (0, _predicates.isCallExpression)(node) || (0, _predicates.isNewExpression)(node) || (0, _predicates.isSequenceExpression)(node) || (0, _predicates.isTemplateLiteral)(node) || (0, _predicates.isTaggedTemplateExpression)(node) || (0, _predicates.isClassExpression)(node) || (0, _predicates.isMetaProperty)(node) || (0, _predicates.isIdentifier)(node) || (0, _predicates.isAwaitExpression)(node) || (0, _predicates.isImportExpression)(node) || (0, _predicates.isChainExpression)(node) || (0, _predicates.isTypeCastExpression)(node) || (0, _predicates.isJSXFragment)(node) || (0, _predicates.isJSXElement)(node);
|
|
152
|
+
return (0, _predicates.isThisExpression)(node) || (0, _predicates.isArrayExpression)(node) || (0, _predicates.isObjectExpression)(node) || (0, _predicates.isFunctionExpression)(node) || (0, _predicates.isArrowFunctionExpression)(node) || (0, _predicates.isYieldExpression)(node) || (0, _predicates.isLiteral)(node) || (0, _predicates.isUnaryExpression)(node) || (0, _predicates.isUpdateExpression)(node) || (0, _predicates.isBinaryExpression)(node) || (0, _predicates.isAssignmentExpression)(node) || (0, _predicates.isLogicalExpression)(node) || (0, _predicates.isMemberExpression)(node) || (0, _predicates.isConditionalExpression)(node) || (0, _predicates.isCallExpression)(node) || (0, _predicates.isNewExpression)(node) || (0, _predicates.isSequenceExpression)(node) || (0, _predicates.isTemplateLiteral)(node) || (0, _predicates.isTaggedTemplateExpression)(node) || (0, _predicates.isClassExpression)(node) || (0, _predicates.isMetaProperty)(node) || (0, _predicates.isIdentifier)(node) || (0, _predicates.isAwaitExpression)(node) || (0, _predicates.isImportExpression)(node) || (0, _predicates.isChainExpression)(node) || (0, _predicates.isTypeCastExpression)(node) || (0, _predicates.isAsExpression)(node) || (0, _predicates.isJSXFragment)(node) || (0, _predicates.isJSXElement)(node);
|
|
153
153
|
} // $FlowFixMe[deprecated-type]
|
|
154
154
|
|
|
155
155
|
|
package/dist/predicates.js.flow
CHANGED
|
@@ -15,6 +15,7 @@ import type {ESNode, Token} from './types';
|
|
|
15
15
|
import {
|
|
16
16
|
isArrayExpression,
|
|
17
17
|
isArrowFunctionExpression,
|
|
18
|
+
isAsExpression,
|
|
18
19
|
isAssignmentExpression,
|
|
19
20
|
isAwaitExpression,
|
|
20
21
|
isBinaryExpression,
|
|
@@ -212,6 +213,7 @@ export function isExpression(node: ESNode): boolean %checks {
|
|
|
212
213
|
isImportExpression(node) ||
|
|
213
214
|
isChainExpression(node) ||
|
|
214
215
|
isTypeCastExpression(node) ||
|
|
216
|
+
isAsExpression(node) ||
|
|
215
217
|
isJSXFragment(node) ||
|
|
216
218
|
isJSXElement(node)
|
|
217
219
|
);
|
package/dist/types.js.flow
CHANGED
|
@@ -189,6 +189,7 @@ export type ESNode =
|
|
|
189
189
|
| TypeParameterInstantiation
|
|
190
190
|
| ComponentDeclaration
|
|
191
191
|
| ComponentParameter
|
|
192
|
+
| HookDeclaration
|
|
192
193
|
| EnumDeclaration
|
|
193
194
|
| EnumNumberBody
|
|
194
195
|
| EnumStringBody
|
|
@@ -236,11 +237,13 @@ export type Statement =
|
|
|
236
237
|
| DebuggerStatement
|
|
237
238
|
| DeclareClass
|
|
238
239
|
| DeclareComponent
|
|
240
|
+
| DeclareHook
|
|
239
241
|
| DeclareVariable
|
|
240
242
|
| DeclareEnum
|
|
241
243
|
| DeclareFunction
|
|
242
244
|
| DeclareInterface
|
|
243
245
|
| DeclareModule
|
|
246
|
+
| DeclareNamespace
|
|
244
247
|
| DeclareOpaqueType
|
|
245
248
|
| DeclareTypeAlias
|
|
246
249
|
| DoWhileStatement
|
|
@@ -251,6 +254,7 @@ export type Statement =
|
|
|
251
254
|
| ForOfStatement
|
|
252
255
|
| ForStatement
|
|
253
256
|
| FunctionDeclaration
|
|
257
|
+
| HookDeclaration
|
|
254
258
|
| IfStatement
|
|
255
259
|
| InterfaceDeclaration
|
|
256
260
|
| LabeledStatement
|
|
@@ -402,6 +406,15 @@ export interface ComponentDeclaration extends BaseNode {
|
|
|
402
406
|
+typeParameters: null | TypeParameterDeclaration;
|
|
403
407
|
}
|
|
404
408
|
|
|
409
|
+
export interface HookDeclaration extends BaseNode {
|
|
410
|
+
+type: 'HookDeclaration';
|
|
411
|
+
+id: Identifier;
|
|
412
|
+
+body: BlockStatement;
|
|
413
|
+
+params: $ReadOnlyArray<FunctionParameter>;
|
|
414
|
+
+returnType: null | TypeAnnotation;
|
|
415
|
+
+typeParameters: null | TypeParameterDeclaration;
|
|
416
|
+
}
|
|
417
|
+
|
|
405
418
|
export interface FunctionDeclaration extends BaseFunction {
|
|
406
419
|
+type: 'FunctionDeclaration';
|
|
407
420
|
/** It is null when a function declaration is a part of the `export default function` statement */
|
|
@@ -1048,7 +1061,8 @@ export interface ImportNamespaceSpecifier extends BaseNode {
|
|
|
1048
1061
|
export type DefaultDeclaration =
|
|
1049
1062
|
| FunctionDeclaration
|
|
1050
1063
|
| ClassDeclaration
|
|
1051
|
-
| ComponentDeclaration
|
|
1064
|
+
| ComponentDeclaration
|
|
1065
|
+
| HookDeclaration;
|
|
1052
1066
|
export type NamedDeclaration =
|
|
1053
1067
|
| DefaultDeclaration
|
|
1054
1068
|
| VariableDeclaration
|
|
@@ -1144,6 +1158,7 @@ export type TypeAnnotationType =
|
|
|
1144
1158
|
| TypeOperator
|
|
1145
1159
|
| TypePredicate
|
|
1146
1160
|
| FunctionTypeAnnotation
|
|
1161
|
+
| HookTypeAnnotation
|
|
1147
1162
|
| ComponentTypeAnnotation
|
|
1148
1163
|
| ObjectTypeAnnotation
|
|
1149
1164
|
| IndexedAccessType
|
|
@@ -1262,6 +1277,7 @@ export interface QualifiedTypeofIdentifier extends BaseNode {
|
|
|
1262
1277
|
export interface TypeofTypeAnnotation extends BaseNode {
|
|
1263
1278
|
+type: 'TypeofTypeAnnotation';
|
|
1264
1279
|
+argument: QualifiedTypeofIdentifier | Identifier;
|
|
1280
|
+
+typeArguments?: TypeParameterInstantiation;
|
|
1265
1281
|
}
|
|
1266
1282
|
export interface KeyofTypeAnnotation extends BaseNode {
|
|
1267
1283
|
+type: 'KeyofTypeAnnotation';
|
|
@@ -1372,6 +1388,13 @@ export interface FunctionTypeParam extends BaseNode {
|
|
|
1372
1388
|
|
|
1373
1389
|
+parent: FunctionTypeAnnotation;
|
|
1374
1390
|
}
|
|
1391
|
+
export interface HookTypeAnnotation extends BaseNode {
|
|
1392
|
+
+type: 'HookTypeAnnotation';
|
|
1393
|
+
+params: $ReadOnlyArray<FunctionTypeParam>;
|
|
1394
|
+
+returnType: TypeAnnotationType;
|
|
1395
|
+
+rest: null | FunctionTypeParam;
|
|
1396
|
+
+typeParameters: null | TypeParameterDeclaration;
|
|
1397
|
+
}
|
|
1375
1398
|
|
|
1376
1399
|
export interface ComponentTypeAnnotation extends BaseNode {
|
|
1377
1400
|
+type: 'ComponentTypeAnnotation';
|
|
@@ -1653,6 +1676,7 @@ export interface EnumDefaultedMember extends BaseNode {
|
|
|
1653
1676
|
export type DeclaredNode =
|
|
1654
1677
|
| DeclareClass
|
|
1655
1678
|
| DeclareComponent
|
|
1679
|
+
| DeclareHook
|
|
1656
1680
|
| DeclareVariable
|
|
1657
1681
|
| DeclareEnum
|
|
1658
1682
|
| DeclareFunction
|
|
@@ -1684,6 +1708,16 @@ export interface DeclareComponent extends BaseNode {
|
|
|
1684
1708
|
+rendersType: null | RendersType;
|
|
1685
1709
|
}
|
|
1686
1710
|
|
|
1711
|
+
export interface DeclareHook extends BaseNode {
|
|
1712
|
+
+type: 'DeclareHook';
|
|
1713
|
+
// the hook signature is stored as a type annotation on the ID
|
|
1714
|
+
+id: interface extends Identifier {
|
|
1715
|
+
+typeAnnotation: interface extends TypeAnnotation {
|
|
1716
|
+
+typeAnnotation: HookTypeAnnotation,
|
|
1717
|
+
},
|
|
1718
|
+
};
|
|
1719
|
+
}
|
|
1720
|
+
|
|
1687
1721
|
export interface DeclareVariable extends BaseNode {
|
|
1688
1722
|
+type: 'DeclareVariable';
|
|
1689
1723
|
+id: Identifier;
|
|
@@ -1711,7 +1745,12 @@ export interface DeclareModule extends BaseNode {
|
|
|
1711
1745
|
+type: 'DeclareModule';
|
|
1712
1746
|
+id: StringLiteral | Identifier;
|
|
1713
1747
|
+body: BlockStatement;
|
|
1714
|
-
|
|
1748
|
+
}
|
|
1749
|
+
|
|
1750
|
+
export interface DeclareNamespace extends BaseNode {
|
|
1751
|
+
+type: 'DeclareNamespace';
|
|
1752
|
+
+id: Identifier;
|
|
1753
|
+
+body: BlockStatement;
|
|
1715
1754
|
}
|
|
1716
1755
|
|
|
1717
1756
|
export interface DeclareInterface extends BaseInterfaceDeclaration {
|
|
@@ -1745,6 +1784,7 @@ export interface DeclareExportDefaultDeclaration
|
|
|
1745
1784
|
| DeclareClass
|
|
1746
1785
|
| DeclareFunction
|
|
1747
1786
|
| DeclareComponent
|
|
1787
|
+
| DeclareHook
|
|
1748
1788
|
| TypeAnnotationType;
|
|
1749
1789
|
+default: true;
|
|
1750
1790
|
// default cannot have a source
|
|
@@ -1759,6 +1799,7 @@ export interface DeclareExportDeclarationNamedWithDeclaration
|
|
|
1759
1799
|
| DeclareClass
|
|
1760
1800
|
| DeclareFunction
|
|
1761
1801
|
| DeclareComponent
|
|
1802
|
+
| DeclareHook
|
|
1762
1803
|
| DeclareInterface
|
|
1763
1804
|
| DeclareOpaqueType
|
|
1764
1805
|
| DeclareVariable
|