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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Error parsing TypeScript generics on left-hand side #16465

Closed
1 task
mtdavis opened this issue May 3, 2024 · 1 comment 路 Fixed by #16476
Closed
1 task

[Bug]: Error parsing TypeScript generics on left-hand side #16465

mtdavis opened this issue May 3, 2024 · 1 comment 路 Fixed by #16476

Comments

@mtdavis
Copy link

mtdavis commented May 3, 2024

馃捇

  • Would you like to work on a fix?

How are you using Babel?

@babel/cli

Input code

REPL link

other compilers for comparison

Configuration file name

.babelrc

Configuration

{
  "presets": [
    [
      "@babel/preset-typescript",
      {
        "allowDeclareFields": true
      }
    ],
    [
      "@babel/preset-env",
      {
        "targets": {
          "node": true
        },
        "modules": "commonjs"
      }
    ]
  ]
}

Current and expected behavior

Current behavior: Babel outputs the error "Invalid left-hand side in assignment expression."

Expected behavior: Babel does not output an error, and generates code similar to what tsc generates.

Environment

  System:
    OS: Windows 10 10.0.19045
  Binaries:
    Node: 20.11.1 - ~\.nvm\versions\node\v20.11.1\bin\node.EXE
    Yarn: 1.22.19 - ~\AppData\Roaming\npm\yarn.CMD
    npm: 10.2.4 - ~\.nvm\versions\node\v20.11.1\bin\npm.CMD
  npmPackages:
    @babel/cli: ^7.23.9 => 7.23.9
    @babel/core: ^7.24.0 => 7.24.0
    @babel/node: ^7.23.9 => 7.23.9
    @babel/polyfill: ^7.11.5 => 7.12.1
    @babel/preset-env: ^7.24.0 => 7.24.0
    @babel/preset-typescript: ^7.23.3 => 7.23.3
    eslint: ^8.57.0 => 8.57.0
    jest: ^29.7.0 => 29.7.0

Possible solution

No response

Additional context

The minimal reproduction code is a little weird, but the real use case where we encountered this issue is when initializing Sequelize model classes that extend a base class.

@babel-bot
Copy link
Collaborator

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

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

Successfully merging a pull request may close this issue.

3 participants