Don't allow instance properties transformation on namespace (#10372)

This commit is contained in:
Bin Xin
2019-09-05 23:32:57 +08:00
committed by Brian Ng
parent 6813ee02d7
commit 29734b924a
13 changed files with 62 additions and 2 deletions

View File

@@ -113,7 +113,14 @@ export default declare((api, options, dirname) => {
);
}
function isNamespaced(path) {
const binding = path.scope.getBinding(path.node.name);
if (!binding) return false;
return binding.path.isImportNamespaceSpecifier();
}
function maybeNeedsPolyfill(path, methods, name) {
if (isNamespaced(path.get("object"))) return false;
if (!methods[name].types) return true;
const typeAnnotation = path.get("object").getTypeAnnotation();

View File

@@ -0,0 +1,2 @@
import * as bar from "bar";
bar.map();

View File

@@ -0,0 +1,3 @@
{
"plugins": [["transform-runtime", { "corejs": 3 }]]
}

View File

@@ -0,0 +1,2 @@
import * as bar from "bar";
bar.map();