flow-remove-types 2.238.3 → 2.239.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.
Files changed (2) hide show
  1. package/index.js +12 -0
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -165,6 +165,18 @@ var removeFlowVisitor = {
165
165
  ClassDeclaration: removeImplementedInterfaces,
166
166
  ClassExpression: removeImplementedInterfaces,
167
167
 
168
+ AsExpression: function (context, node, ast) {
169
+ var typeIdx = findTokenIndexAtStartOfNode(ast.tokens, node.typeAnnotation);
170
+ removeNode(context, ast.tokens[typeIdx - 1]); // `as` token
171
+ removeNode(context, node.typeAnnotation);
172
+ },
173
+
174
+ AsConstExpression: function (context, node, ast) {
175
+ var idx = findTokenIndexAtEndOfNode(ast.tokens, node.expression);
176
+ removeNode(context, ast.tokens[idx + 1]); // `as` token
177
+ removeNode(context, ast.tokens[idx + 2]); // `const` token
178
+ },
179
+
168
180
  Identifier: function (context, node, ast) {
169
181
  if (node[THIS_PARAM_MARKER] === true) {
170
182
  removeNode(context, node);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flow-remove-types",
3
- "version": "2.238.3",
3
+ "version": "2.239.0",
4
4
  "description": "Removes Flow type annotations from JavaScript files with speed and simplicity.",
5
5
  "author": {
6
6
  "name": "Flow Team",