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

[Bug]: Property init of ForStatement expected node to be of a type #14840

Closed
1 task
clhiker opened this issue Aug 10, 2022 · 1 comment · Fixed by #14841
Closed
1 task

[Bug]: Property init of ForStatement expected node to be of a type #14840

clhiker opened this issue Aug 10, 2022 · 1 comment · Fixed by #14841
Labels
i: bug outdated A closed issue/PR that is archived due to age. Recommended to make a new issue pkg: preset-env

Comments

@clhiker
Copy link

clhiker commented Aug 10, 2022

💻

  • Would you like to work on a fix?

How are you using Babel?

@babel/cli

Input code

for ( let x in Symbol.replace ) for ( var { } = x ; ; ) ;

Here is the REPL

Configuration file name

babel.config.json

Configuration

{
  "sourceType": "unambiguous",
  "presets": ["@babel/preset-env"],
  "plugins": [
    "@babel/plugin-transform-runtime"
  ]
}

Current and expected behavior

When Babel transpiles this code, it throws the following error:

Property init of ForStatement expected node to be of a type ["VariableDeclaration","Expression"] but instead got "ExpressionStatement"

However, the code can be run by node and transpiled by swc. This is the repl

Environment

  • babel
    • ├── @babel/cli@7.18.6
    • ├── @babel/plugin-transform-runtime@7.18.6
    • ├── @babel/preset-env@7.18.6
  • Node: [v17.3.0]
  • npm version [8.5.2]
  • os [ubuntu 20.04]

Possible solution

No response

Additional context

No response

@babel-bot
Copy link
Collaborator

Hey @clhiker! 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.

@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 Nov 10, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 10, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
i: bug outdated A closed issue/PR that is archived due to age. Recommended to make a new issue pkg: preset-env
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants