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

transforming "typeof" to "_typeof" causes an error in Javascript in many webpages #13062

Closed
gogo9th opened this issue Mar 27, 2021 · 4 comments
Closed
Labels
i: enhancement i: needs triage Needs Info outdated A closed issue/PR that is archived due to age. Recommended to make a new issue

Comments

@gogo9th
Copy link

gogo9th commented Mar 27, 2021

Feature Request

Is your feature request related to a problem?
Babel transforms "typeof" to "_typeof". However, some Javascript such as the one in nationalgeographic.com defines the _typeof function, which causes an error due to the conflicting name.

Describe the solution you'd like
The transformed keyword should be more complex than this to avoid conflicts, for example," __babel__typeof." I wonder which files I should modify in order to apply this change.

@babel-bot
Copy link
Collaborator

Hey @gogo9th! We really appreciate you taking the time to report an issue. The collaborators on this project attempt to help as many people as possible, but we're a limited number of volunteers, so it's possible this won't be addressed swiftly.

If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack community that typically always has someone willing to help. You can sign-up here for an invite."

@nicolo-ribaudo
Copy link
Member

The only _typeof function I can find on https://www.nationalgeographic.com/ is the one defined by Babel, so even renaming it wouldn't avoid the conflict.

However, I don't understand why it causes a problem: are you re-transforming the web pages you visit with Babel?

@fengxinming
Copy link

I had a same problem about _typeof

@babel-bot
Copy link
Collaborator

Hi @gogo9th! This issue is missing some important information we'll need to be able to reproduce this issue.

Please understand that we receive a high volume of issues, and there are only a limited number of volunteers that help maintain this project. The easier it is for us to decipher an issue with the info provided, the more likely it is that we'll be able to help.

Please make sure you have the following information documented in this ticket:

  1. Your Babel configuration (typically from .babelrc or babel.config.js)
  2. The current (incorrect) behavior you're seeing
  3. The behavior you expect
  4. A short, self-contained example

Please provide either a link to the problem via the repl, or if the repl is insufficient, a new and minimal repository with instructions on how to build/replicate the issue.

@github-actions github-actions bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Dec 2, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 2, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
i: enhancement i: needs triage Needs Info outdated A closed issue/PR that is archived due to age. Recommended to make a new issue
Projects
None yet
Development

No branches or pull requests

4 participants