hermes-estree 0.18.2 → 0.19.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.
|
@@ -61,6 +61,7 @@ import type {
|
|
|
61
61
|
DeclareExportAllDeclaration,
|
|
62
62
|
DeclareExportDeclaration,
|
|
63
63
|
DeclareFunction,
|
|
64
|
+
DeclareHook,
|
|
64
65
|
DeclareInterface,
|
|
65
66
|
DeclareModule,
|
|
66
67
|
DeclareModuleExports,
|
|
@@ -93,6 +94,8 @@ import type {
|
|
|
93
94
|
FunctionTypeAnnotation,
|
|
94
95
|
FunctionTypeParam,
|
|
95
96
|
GenericTypeAnnotation,
|
|
97
|
+
HookDeclaration,
|
|
98
|
+
HookTypeAnnotation,
|
|
96
99
|
Identifier,
|
|
97
100
|
IfStatement,
|
|
98
101
|
ImportAttribute,
|
|
@@ -502,6 +505,9 @@ interface DeclareFunction_With_id extends DeclareFunction {
|
|
|
502
505
|
interface DeclareFunction_With_predicate extends DeclareFunction {
|
|
503
506
|
+predicate: $NonMaybeType<DeclareFunction['predicate']>;
|
|
504
507
|
}
|
|
508
|
+
interface DeclareHook_With_id extends DeclareHook {
|
|
509
|
+
+id: $NonMaybeType<DeclareHook['id']>;
|
|
510
|
+
}
|
|
505
511
|
interface DeclareInterface_With_id extends DeclareInterface {
|
|
506
512
|
+id: $NonMaybeType<DeclareInterface['id']>;
|
|
507
513
|
}
|
|
@@ -774,6 +780,33 @@ interface GenericTypeAnnotation_With_typeParameters
|
|
|
774
780
|
extends GenericTypeAnnotation {
|
|
775
781
|
+typeParameters: $NonMaybeType<GenericTypeAnnotation['typeParameters']>;
|
|
776
782
|
}
|
|
783
|
+
interface HookDeclaration_With_id extends HookDeclaration {
|
|
784
|
+
+id: $NonMaybeType<HookDeclaration['id']>;
|
|
785
|
+
}
|
|
786
|
+
interface HookDeclaration_With_params extends HookDeclaration {
|
|
787
|
+
+params: $NonMaybeType<HookDeclaration['params']>;
|
|
788
|
+
}
|
|
789
|
+
interface HookDeclaration_With_body extends HookDeclaration {
|
|
790
|
+
+body: $NonMaybeType<HookDeclaration['body']>;
|
|
791
|
+
}
|
|
792
|
+
interface HookDeclaration_With_typeParameters extends HookDeclaration {
|
|
793
|
+
+typeParameters: $NonMaybeType<HookDeclaration['typeParameters']>;
|
|
794
|
+
}
|
|
795
|
+
interface HookDeclaration_With_returnType extends HookDeclaration {
|
|
796
|
+
+returnType: $NonMaybeType<HookDeclaration['returnType']>;
|
|
797
|
+
}
|
|
798
|
+
interface HookTypeAnnotation_With_params extends HookTypeAnnotation {
|
|
799
|
+
+params: $NonMaybeType<HookTypeAnnotation['params']>;
|
|
800
|
+
}
|
|
801
|
+
interface HookTypeAnnotation_With_returnType extends HookTypeAnnotation {
|
|
802
|
+
+returnType: $NonMaybeType<HookTypeAnnotation['returnType']>;
|
|
803
|
+
}
|
|
804
|
+
interface HookTypeAnnotation_With_rest extends HookTypeAnnotation {
|
|
805
|
+
+rest: $NonMaybeType<HookTypeAnnotation['rest']>;
|
|
806
|
+
}
|
|
807
|
+
interface HookTypeAnnotation_With_typeParameters extends HookTypeAnnotation {
|
|
808
|
+
+typeParameters: $NonMaybeType<HookTypeAnnotation['typeParameters']>;
|
|
809
|
+
}
|
|
777
810
|
interface Identifier_With_name extends Identifier {
|
|
778
811
|
+name: $NonMaybeType<Identifier['name']>;
|
|
779
812
|
}
|
|
@@ -1320,6 +1353,9 @@ interface TypeCastExpression_With_typeAnnotation extends TypeCastExpression {
|
|
|
1320
1353
|
interface TypeofTypeAnnotation_With_argument extends TypeofTypeAnnotation {
|
|
1321
1354
|
+argument: $NonMaybeType<TypeofTypeAnnotation['argument']>;
|
|
1322
1355
|
}
|
|
1356
|
+
interface TypeofTypeAnnotation_With_typeArguments extends TypeofTypeAnnotation {
|
|
1357
|
+
+typeArguments: $NonMaybeType<TypeofTypeAnnotation['typeArguments']>;
|
|
1358
|
+
}
|
|
1323
1359
|
interface TypeOperator_With_operator extends TypeOperator {
|
|
1324
1360
|
+operator: $NonMaybeType<TypeOperator['operator']>;
|
|
1325
1361
|
}
|
|
@@ -1442,6 +1478,7 @@ type DeclarationSpecialSelector =
|
|
|
1442
1478
|
| ExportDefaultDeclaration
|
|
1443
1479
|
| ExportNamedDeclaration
|
|
1444
1480
|
| FunctionDeclaration
|
|
1481
|
+
| HookDeclaration
|
|
1445
1482
|
| ImportDeclaration
|
|
1446
1483
|
| InterfaceDeclaration
|
|
1447
1484
|
| TypeParameterDeclaration
|
|
@@ -1736,6 +1773,8 @@ export type ESQueryNodeSelectorsWithoutFallback = {
|
|
|
1736
1773
|
+'DeclareFunction[predicate]'?: (
|
|
1737
1774
|
node: DeclareFunction_With_predicate,
|
|
1738
1775
|
) => void,
|
|
1776
|
+
+DeclareHook?: (node: DeclareHook) => void,
|
|
1777
|
+
+'DeclareHook[id]'?: (node: DeclareHook_With_id) => void,
|
|
1739
1778
|
+DeclareInterface?: (node: DeclareInterface) => void,
|
|
1740
1779
|
+'DeclareInterface[id]'?: (node: DeclareInterface_With_id) => void,
|
|
1741
1780
|
+'DeclareInterface[typeParameters]'?: (
|
|
@@ -1940,6 +1979,27 @@ export type ESQueryNodeSelectorsWithoutFallback = {
|
|
|
1940
1979
|
+'GenericTypeAnnotation[typeParameters]'?: (
|
|
1941
1980
|
node: GenericTypeAnnotation_With_typeParameters,
|
|
1942
1981
|
) => void,
|
|
1982
|
+
+HookDeclaration?: (node: HookDeclaration) => void,
|
|
1983
|
+
+'HookDeclaration[id]'?: (node: HookDeclaration_With_id) => void,
|
|
1984
|
+
+'HookDeclaration[params]'?: (node: HookDeclaration_With_params) => void,
|
|
1985
|
+
+'HookDeclaration[body]'?: (node: HookDeclaration_With_body) => void,
|
|
1986
|
+
+'HookDeclaration[typeParameters]'?: (
|
|
1987
|
+
node: HookDeclaration_With_typeParameters,
|
|
1988
|
+
) => void,
|
|
1989
|
+
+'HookDeclaration[returnType]'?: (
|
|
1990
|
+
node: HookDeclaration_With_returnType,
|
|
1991
|
+
) => void,
|
|
1992
|
+
+HookTypeAnnotation?: (node: HookTypeAnnotation) => void,
|
|
1993
|
+
+'HookTypeAnnotation[params]'?: (
|
|
1994
|
+
node: HookTypeAnnotation_With_params,
|
|
1995
|
+
) => void,
|
|
1996
|
+
+'HookTypeAnnotation[returnType]'?: (
|
|
1997
|
+
node: HookTypeAnnotation_With_returnType,
|
|
1998
|
+
) => void,
|
|
1999
|
+
+'HookTypeAnnotation[rest]'?: (node: HookTypeAnnotation_With_rest) => void,
|
|
2000
|
+
+'HookTypeAnnotation[typeParameters]'?: (
|
|
2001
|
+
node: HookTypeAnnotation_With_typeParameters,
|
|
2002
|
+
) => void,
|
|
1943
2003
|
+Identifier?: (node: Identifier) => void,
|
|
1944
2004
|
+'Identifier[name]'?: (node: Identifier_With_name) => void,
|
|
1945
2005
|
+'Identifier[typeAnnotation]'?: (
|
|
@@ -2395,6 +2455,9 @@ export type ESQueryNodeSelectorsWithoutFallback = {
|
|
|
2395
2455
|
+'TypeofTypeAnnotation[argument]'?: (
|
|
2396
2456
|
node: TypeofTypeAnnotation_With_argument,
|
|
2397
2457
|
) => void,
|
|
2458
|
+
+'TypeofTypeAnnotation[typeArguments]'?: (
|
|
2459
|
+
node: TypeofTypeAnnotation_With_typeArguments,
|
|
2460
|
+
) => void,
|
|
2398
2461
|
+TypeOperator?: (node: TypeOperator) => void,
|
|
2399
2462
|
+'TypeOperator[operator]'?: (node: TypeOperator_With_operator) => void,
|
|
2400
2463
|
+'TypeOperator[typeAnnotation]'?: (
|
|
@@ -2751,6 +2814,8 @@ export type ESQueryNodeSelectorsWithoutFallback = {
|
|
|
2751
2814
|
+'DeclareFunction[predicate]:exit'?: (
|
|
2752
2815
|
node: DeclareFunction_With_predicate,
|
|
2753
2816
|
) => void,
|
|
2817
|
+
+'DeclareHook:exit'?: (node: DeclareHook) => void,
|
|
2818
|
+
+'DeclareHook[id]:exit'?: (node: DeclareHook_With_id) => void,
|
|
2754
2819
|
+'DeclareInterface:exit'?: (node: DeclareInterface) => void,
|
|
2755
2820
|
+'DeclareInterface[id]:exit'?: (node: DeclareInterface_With_id) => void,
|
|
2756
2821
|
+'DeclareInterface[typeParameters]:exit'?: (
|
|
@@ -2969,6 +3034,29 @@ export type ESQueryNodeSelectorsWithoutFallback = {
|
|
|
2969
3034
|
+'GenericTypeAnnotation[typeParameters]:exit'?: (
|
|
2970
3035
|
node: GenericTypeAnnotation_With_typeParameters,
|
|
2971
3036
|
) => void,
|
|
3037
|
+
+'HookDeclaration:exit'?: (node: HookDeclaration) => void,
|
|
3038
|
+
+'HookDeclaration[id]:exit'?: (node: HookDeclaration_With_id) => void,
|
|
3039
|
+
+'HookDeclaration[params]:exit'?: (node: HookDeclaration_With_params) => void,
|
|
3040
|
+
+'HookDeclaration[body]:exit'?: (node: HookDeclaration_With_body) => void,
|
|
3041
|
+
+'HookDeclaration[typeParameters]:exit'?: (
|
|
3042
|
+
node: HookDeclaration_With_typeParameters,
|
|
3043
|
+
) => void,
|
|
3044
|
+
+'HookDeclaration[returnType]:exit'?: (
|
|
3045
|
+
node: HookDeclaration_With_returnType,
|
|
3046
|
+
) => void,
|
|
3047
|
+
+'HookTypeAnnotation:exit'?: (node: HookTypeAnnotation) => void,
|
|
3048
|
+
+'HookTypeAnnotation[params]:exit'?: (
|
|
3049
|
+
node: HookTypeAnnotation_With_params,
|
|
3050
|
+
) => void,
|
|
3051
|
+
+'HookTypeAnnotation[returnType]:exit'?: (
|
|
3052
|
+
node: HookTypeAnnotation_With_returnType,
|
|
3053
|
+
) => void,
|
|
3054
|
+
+'HookTypeAnnotation[rest]:exit'?: (
|
|
3055
|
+
node: HookTypeAnnotation_With_rest,
|
|
3056
|
+
) => void,
|
|
3057
|
+
+'HookTypeAnnotation[typeParameters]:exit'?: (
|
|
3058
|
+
node: HookTypeAnnotation_With_typeParameters,
|
|
3059
|
+
) => void,
|
|
2972
3060
|
+'Identifier:exit'?: (node: Identifier) => void,
|
|
2973
3061
|
+'Identifier[name]:exit'?: (node: Identifier_With_name) => void,
|
|
2974
3062
|
+'Identifier[typeAnnotation]:exit'?: (
|
|
@@ -3468,6 +3556,9 @@ export type ESQueryNodeSelectorsWithoutFallback = {
|
|
|
3468
3556
|
+'TypeofTypeAnnotation[argument]:exit'?: (
|
|
3469
3557
|
node: TypeofTypeAnnotation_With_argument,
|
|
3470
3558
|
) => void,
|
|
3559
|
+
+'TypeofTypeAnnotation[typeArguments]:exit'?: (
|
|
3560
|
+
node: TypeofTypeAnnotation_With_typeArguments,
|
|
3561
|
+
) => void,
|
|
3471
3562
|
+'TypeOperator:exit'?: (node: TypeOperator) => void,
|
|
3472
3563
|
+'TypeOperator[operator]:exit'?: (node: TypeOperator_With_operator) => void,
|
|
3473
3564
|
+'TypeOperator[typeAnnotation]:exit'?: (
|
|
@@ -64,6 +64,7 @@ import type {
|
|
|
64
64
|
DeclareExportAllDeclaration,
|
|
65
65
|
DeclareExportDeclaration,
|
|
66
66
|
DeclareFunction,
|
|
67
|
+
DeclareHook,
|
|
67
68
|
DeclareInterface,
|
|
68
69
|
DeclareModule,
|
|
69
70
|
DeclareModuleExports,
|
|
@@ -96,6 +97,8 @@ import type {
|
|
|
96
97
|
FunctionTypeAnnotation,
|
|
97
98
|
FunctionTypeParam,
|
|
98
99
|
GenericTypeAnnotation,
|
|
100
|
+
HookDeclaration,
|
|
101
|
+
HookTypeAnnotation,
|
|
99
102
|
IfStatement,
|
|
100
103
|
ImportAttribute,
|
|
101
104
|
ImportDeclaration,
|
|
@@ -266,6 +269,7 @@ exports.isDeclareEnum = isDeclareEnum;
|
|
|
266
269
|
exports.isDeclareExportAllDeclaration = isDeclareExportAllDeclaration;
|
|
267
270
|
exports.isDeclareExportDeclaration = isDeclareExportDeclaration;
|
|
268
271
|
exports.isDeclareFunction = isDeclareFunction;
|
|
272
|
+
exports.isDeclareHook = isDeclareHook;
|
|
269
273
|
exports.isDeclareInterface = isDeclareInterface;
|
|
270
274
|
exports.isDeclareKeyword = isDeclareKeyword;
|
|
271
275
|
exports.isDeclareModule = isDeclareModule;
|
|
@@ -322,6 +326,8 @@ exports.isGenericTypeAnnotation = isGenericTypeAnnotation;
|
|
|
322
326
|
exports.isGetKeyword = isGetKeyword;
|
|
323
327
|
exports.isGreaterThanOrEqualToToken = isGreaterThanOrEqualToToken;
|
|
324
328
|
exports.isGreaterThanToken = isGreaterThanToken;
|
|
329
|
+
exports.isHookDeclaration = isHookDeclaration;
|
|
330
|
+
exports.isHookTypeAnnotation = isHookTypeAnnotation;
|
|
325
331
|
exports.isIdentifier = isIdentifier;
|
|
326
332
|
exports.isIfStatement = isIfStatement;
|
|
327
333
|
exports.isIfToken = isIfToken;
|
|
@@ -805,6 +811,14 @@ function isDeclareFunction(node
|
|
|
805
811
|
return node.type === 'DeclareFunction';
|
|
806
812
|
}
|
|
807
813
|
|
|
814
|
+
function isDeclareHook(node
|
|
815
|
+
/*: ESNode | Token */
|
|
816
|
+
)
|
|
817
|
+
/*: node is DeclareHook */
|
|
818
|
+
{
|
|
819
|
+
return node.type === 'DeclareHook';
|
|
820
|
+
}
|
|
821
|
+
|
|
808
822
|
function isDeclareInterface(node
|
|
809
823
|
/*: ESNode | Token */
|
|
810
824
|
)
|
|
@@ -1061,6 +1075,22 @@ function isGenericTypeAnnotation(node
|
|
|
1061
1075
|
return node.type === 'GenericTypeAnnotation';
|
|
1062
1076
|
}
|
|
1063
1077
|
|
|
1078
|
+
function isHookDeclaration(node
|
|
1079
|
+
/*: ESNode | Token */
|
|
1080
|
+
)
|
|
1081
|
+
/*: node is HookDeclaration */
|
|
1082
|
+
{
|
|
1083
|
+
return node.type === 'HookDeclaration';
|
|
1084
|
+
}
|
|
1085
|
+
|
|
1086
|
+
function isHookTypeAnnotation(node
|
|
1087
|
+
/*: ESNode | Token */
|
|
1088
|
+
)
|
|
1089
|
+
/*: node is HookTypeAnnotation */
|
|
1090
|
+
{
|
|
1091
|
+
return node.type === 'HookTypeAnnotation';
|
|
1092
|
+
}
|
|
1093
|
+
|
|
1064
1094
|
function isIfStatement(node
|
|
1065
1095
|
/*: ESNode | Token */
|
|
1066
1096
|
)
|
|
@@ -65,6 +65,7 @@ import type {
|
|
|
65
65
|
DeclareExportAllDeclaration,
|
|
66
66
|
DeclareExportDeclaration,
|
|
67
67
|
DeclareFunction,
|
|
68
|
+
DeclareHook,
|
|
68
69
|
DeclareInterface,
|
|
69
70
|
DeclareModule,
|
|
70
71
|
DeclareModuleExports,
|
|
@@ -97,6 +98,8 @@ import type {
|
|
|
97
98
|
FunctionTypeAnnotation,
|
|
98
99
|
FunctionTypeParam,
|
|
99
100
|
GenericTypeAnnotation,
|
|
101
|
+
HookDeclaration,
|
|
102
|
+
HookTypeAnnotation,
|
|
100
103
|
IfStatement,
|
|
101
104
|
ImportAttribute,
|
|
102
105
|
ImportDeclaration,
|
|
@@ -404,6 +407,11 @@ export function isDeclareFunction(node /*: ESNode | Token */) /*: node is Declar
|
|
|
404
407
|
}
|
|
405
408
|
|
|
406
409
|
|
|
410
|
+
export function isDeclareHook(node /*: ESNode | Token */) /*: node is DeclareHook */ {
|
|
411
|
+
return node.type === 'DeclareHook';
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
|
|
407
415
|
export function isDeclareInterface(node /*: ESNode | Token */) /*: node is DeclareInterface */ {
|
|
408
416
|
return node.type === 'DeclareInterface';
|
|
409
417
|
}
|
|
@@ -564,6 +572,16 @@ export function isGenericTypeAnnotation(node /*: ESNode | Token */) /*: node is
|
|
|
564
572
|
}
|
|
565
573
|
|
|
566
574
|
|
|
575
|
+
export function isHookDeclaration(node /*: ESNode | Token */) /*: node is HookDeclaration */ {
|
|
576
|
+
return node.type === 'HookDeclaration';
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
|
|
580
|
+
export function isHookTypeAnnotation(node /*: ESNode | Token */) /*: node is HookTypeAnnotation */ {
|
|
581
|
+
return node.type === 'HookTypeAnnotation';
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
|
|
567
585
|
export function isIfStatement(node /*: ESNode | Token */) /*: node is IfStatement */ {
|
|
568
586
|
return node.type === 'IfStatement';
|
|
569
587
|
}
|
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,6 +237,7 @@ export type Statement =
|
|
|
236
237
|
| DebuggerStatement
|
|
237
238
|
| DeclareClass
|
|
238
239
|
| DeclareComponent
|
|
240
|
+
| DeclareHook
|
|
239
241
|
| DeclareVariable
|
|
240
242
|
| DeclareEnum
|
|
241
243
|
| DeclareFunction
|
|
@@ -251,6 +253,7 @@ export type Statement =
|
|
|
251
253
|
| ForOfStatement
|
|
252
254
|
| ForStatement
|
|
253
255
|
| FunctionDeclaration
|
|
256
|
+
| HookDeclaration
|
|
254
257
|
| IfStatement
|
|
255
258
|
| InterfaceDeclaration
|
|
256
259
|
| LabeledStatement
|
|
@@ -402,6 +405,15 @@ export interface ComponentDeclaration extends BaseNode {
|
|
|
402
405
|
+typeParameters: null | TypeParameterDeclaration;
|
|
403
406
|
}
|
|
404
407
|
|
|
408
|
+
export interface HookDeclaration extends BaseNode {
|
|
409
|
+
+type: 'HookDeclaration';
|
|
410
|
+
+id: Identifier;
|
|
411
|
+
+body: BlockStatement;
|
|
412
|
+
+params: $ReadOnlyArray<FunctionParameter>;
|
|
413
|
+
+returnType: null | TypeAnnotation;
|
|
414
|
+
+typeParameters: null | TypeParameterDeclaration;
|
|
415
|
+
}
|
|
416
|
+
|
|
405
417
|
export interface FunctionDeclaration extends BaseFunction {
|
|
406
418
|
+type: 'FunctionDeclaration';
|
|
407
419
|
/** It is null when a function declaration is a part of the `export default function` statement */
|
|
@@ -1048,7 +1060,8 @@ export interface ImportNamespaceSpecifier extends BaseNode {
|
|
|
1048
1060
|
export type DefaultDeclaration =
|
|
1049
1061
|
| FunctionDeclaration
|
|
1050
1062
|
| ClassDeclaration
|
|
1051
|
-
| ComponentDeclaration
|
|
1063
|
+
| ComponentDeclaration
|
|
1064
|
+
| HookDeclaration;
|
|
1052
1065
|
export type NamedDeclaration =
|
|
1053
1066
|
| DefaultDeclaration
|
|
1054
1067
|
| VariableDeclaration
|
|
@@ -1144,6 +1157,7 @@ export type TypeAnnotationType =
|
|
|
1144
1157
|
| TypeOperator
|
|
1145
1158
|
| TypePredicate
|
|
1146
1159
|
| FunctionTypeAnnotation
|
|
1160
|
+
| HookTypeAnnotation
|
|
1147
1161
|
| ComponentTypeAnnotation
|
|
1148
1162
|
| ObjectTypeAnnotation
|
|
1149
1163
|
| IndexedAccessType
|
|
@@ -1262,6 +1276,7 @@ export interface QualifiedTypeofIdentifier extends BaseNode {
|
|
|
1262
1276
|
export interface TypeofTypeAnnotation extends BaseNode {
|
|
1263
1277
|
+type: 'TypeofTypeAnnotation';
|
|
1264
1278
|
+argument: QualifiedTypeofIdentifier | Identifier;
|
|
1279
|
+
+typeArguments?: TypeParameterInstantiation;
|
|
1265
1280
|
}
|
|
1266
1281
|
export interface KeyofTypeAnnotation extends BaseNode {
|
|
1267
1282
|
+type: 'KeyofTypeAnnotation';
|
|
@@ -1372,6 +1387,13 @@ export interface FunctionTypeParam extends BaseNode {
|
|
|
1372
1387
|
|
|
1373
1388
|
+parent: FunctionTypeAnnotation;
|
|
1374
1389
|
}
|
|
1390
|
+
export interface HookTypeAnnotation extends BaseNode {
|
|
1391
|
+
+type: 'HookTypeAnnotation';
|
|
1392
|
+
+params: $ReadOnlyArray<FunctionTypeParam>;
|
|
1393
|
+
+returnType: TypeAnnotationType;
|
|
1394
|
+
+rest: null | FunctionTypeParam;
|
|
1395
|
+
+typeParameters: null | TypeParameterDeclaration;
|
|
1396
|
+
}
|
|
1375
1397
|
|
|
1376
1398
|
export interface ComponentTypeAnnotation extends BaseNode {
|
|
1377
1399
|
+type: 'ComponentTypeAnnotation';
|
|
@@ -1653,6 +1675,7 @@ export interface EnumDefaultedMember extends BaseNode {
|
|
|
1653
1675
|
export type DeclaredNode =
|
|
1654
1676
|
| DeclareClass
|
|
1655
1677
|
| DeclareComponent
|
|
1678
|
+
| DeclareHook
|
|
1656
1679
|
| DeclareVariable
|
|
1657
1680
|
| DeclareEnum
|
|
1658
1681
|
| DeclareFunction
|
|
@@ -1684,6 +1707,16 @@ export interface DeclareComponent extends BaseNode {
|
|
|
1684
1707
|
+rendersType: null | RendersType;
|
|
1685
1708
|
}
|
|
1686
1709
|
|
|
1710
|
+
export interface DeclareHook extends BaseNode {
|
|
1711
|
+
+type: 'DeclareHook';
|
|
1712
|
+
// the hook signature is stored as a type annotation on the ID
|
|
1713
|
+
+id: interface extends Identifier {
|
|
1714
|
+
+typeAnnotation: interface extends TypeAnnotation {
|
|
1715
|
+
+typeAnnotation: HookTypeAnnotation,
|
|
1716
|
+
},
|
|
1717
|
+
};
|
|
1718
|
+
}
|
|
1719
|
+
|
|
1687
1720
|
export interface DeclareVariable extends BaseNode {
|
|
1688
1721
|
+type: 'DeclareVariable';
|
|
1689
1722
|
+id: Identifier;
|
|
@@ -1745,6 +1778,7 @@ export interface DeclareExportDefaultDeclaration
|
|
|
1745
1778
|
| DeclareClass
|
|
1746
1779
|
| DeclareFunction
|
|
1747
1780
|
| DeclareComponent
|
|
1781
|
+
| DeclareHook
|
|
1748
1782
|
| TypeAnnotationType;
|
|
1749
1783
|
+default: true;
|
|
1750
1784
|
// default cannot have a source
|
|
@@ -1759,6 +1793,7 @@ export interface DeclareExportDeclarationNamedWithDeclaration
|
|
|
1759
1793
|
| DeclareClass
|
|
1760
1794
|
| DeclareFunction
|
|
1761
1795
|
| DeclareComponent
|
|
1796
|
+
| DeclareHook
|
|
1762
1797
|
| DeclareInterface
|
|
1763
1798
|
| DeclareOpaqueType
|
|
1764
1799
|
| DeclareVariable
|