flow-remove-types 2.275.0 → 2.276.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.
- package/index.js +16 -2
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -158,9 +158,7 @@ var removeFlowVisitor = {
|
|
|
158
158
|
DeclareVariable: removeNode,
|
|
159
159
|
InterfaceDeclaration: removeNode,
|
|
160
160
|
TypeAlias: removeNode,
|
|
161
|
-
TypeAnnotation: removeNodeIfNotCommentType,
|
|
162
161
|
TypePredicate: removeNodeIfNotCommentType,
|
|
163
|
-
TypeParameterDeclaration: removeNode,
|
|
164
162
|
InferredPredicate: removeInferredPredicateNode,
|
|
165
163
|
OpaqueType: removeNode,
|
|
166
164
|
DeclareOpaqueType: removeNode,
|
|
@@ -366,6 +364,22 @@ var removeFlowVisitor = {
|
|
|
366
364
|
}
|
|
367
365
|
},
|
|
368
366
|
|
|
367
|
+
TypeAnnotation: function (context, node, ast, parent) {
|
|
368
|
+
if (parent.default) {
|
|
369
|
+
return;
|
|
370
|
+
}
|
|
371
|
+
return removeNodeIfNotCommentType(context, node, ast, parent);
|
|
372
|
+
},
|
|
373
|
+
|
|
374
|
+
TypeParameterDeclaration: function (context, node, ast, parent) {
|
|
375
|
+
if (
|
|
376
|
+
parent.type !== 'ComponentTypeAnnotation' &&
|
|
377
|
+
parent.type !== 'FunctionTypeAnnotation'
|
|
378
|
+
) {
|
|
379
|
+
return removeNode(context, node);
|
|
380
|
+
}
|
|
381
|
+
},
|
|
382
|
+
|
|
369
383
|
TypeParameterInstantiation: function (context, node, ast, parent) {
|
|
370
384
|
// prevent interference with asExpression removal
|
|
371
385
|
if (parent.type !== 'GenericTypeAnnotation') {
|