Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't allow instance properties transformation on namespace #10372

Merged
merged 2 commits into from Sep 5, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions packages/babel-plugin-transform-runtime/src/index.js
Expand Up @@ -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;
JLHwung marked this conversation as resolved.
Show resolved Hide resolved
if (!methods[name].types) return true;

const typeAnnotation = path.get("object").getTypeAnnotation();
Expand Down
@@ -0,0 +1,2 @@
import * as bar from "bar";
bar.map();
@@ -0,0 +1,3 @@
{
"plugins": [["transform-runtime", { "corejs": 3 }]]
}
@@ -0,0 +1,2 @@
import * as bar from "bar";
bar.map();