flow-remove-types 2.246.0 → 2.247.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.
Files changed (2) hide show
  1. package/index.js +5 -1
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -168,7 +168,11 @@ var removeFlowVisitor = {
168
168
  AsExpression: function (context, node, ast) {
169
169
  var typeIdx = findTokenIndexAtStartOfNode(ast.tokens, node.typeAnnotation);
170
170
  removeNode(context, ast.tokens[typeIdx - 1]); // `as` token
171
- removeNode(context, node.typeAnnotation);
171
+ if (node.typeAnnotation.type === 'GenericTypeAnnotation') {
172
+ removeNode(context, ast.tokens[typeIdx]);
173
+ } else {
174
+ removeNode(context, node.typeAnnotation);
175
+ }
172
176
  },
173
177
 
174
178
  AsConstExpression: function (context, node, ast) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flow-remove-types",
3
- "version": "2.246.0",
3
+ "version": "2.247.1",
4
4
  "description": "Removes Flow type annotations from JavaScript files with speed and simplicity.",
5
5
  "author": {
6
6
  "name": "Flow Team",