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

Circular 'typeof' generation on typeof-symbol, spread and modules-amd plugins combination #612

Closed
jevgenig opened this issue Dec 1, 2015 · 2 comments

Comments

@jevgenig
Copy link

jevgenig commented Dec 1, 2015

Combination of three plugins, generates circular "_typeof" call

Files used:

.babelrc

{
  "presets": [],
  "plugins": ["transform-es2015-typeof-symbol","transform-es2015-spread","transform-es2015-modules-amd"]
}

test.js

[].push(...1);
typeof 1 === "object";

Executing

babel test.js

Results in generation of JS which contains (Note _typeof(obj) self-call in the end of return):

  function _typeof(obj) {
    return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol 
           ? "symbol" : typeof obj === "undefined" ? "undefined" : _typeof(obj);
  }

Should generate:

  function _typeof(obj) {
    return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol 
           ? "symbol" : typeof obj === "undefined" ? "undefined" : typeof obj;
  }

Versions

babel 6.2.0
babel-core 6.2.1
plugins 6.1.18

If "modules-amd" plugin is excluded, output is as expected

@loganfsmyth
Copy link
Member

This is not the right place to report bugs, see our README:

Want to report a bug or request a feature?

Bugs and feature requests should be posted at phabricator.babeljs.io.

This bug is tracked here: https://phabricator.babeljs.io/T6644

@jevgenig
Copy link
Author

jevgenig commented Dec 1, 2015

My bad, many thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants