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]: @babel/plugin-proposal-decorators, auto-accessors affect other initializers #15050

Closed
1 task
rauschma opened this issue Oct 16, 2022 · 2 comments 路 Fixed by #15059
Closed
1 task

[Bug]: @babel/plugin-proposal-decorators, auto-accessors affect other initializers #15050

rauschma opened this issue Oct 16, 2022 · 2 comments 路 Fixed by #15059
Assignees
Labels
i: bug outdated A closed issue/PR that is archived due to age. Recommended to make a new issue Spec: Decorators

Comments

@rauschma
Copy link

rauschma commented Oct 16, 2022

馃捇

  • Would you like to work on a fix?

How are you using Babel?

@babel/register or @babel/node

Input code

function init(_value, {name, addInitializer}) {
  addInitializer(function () {
    console.log(name, typeof this);
  });
}
class C {
  @init static accessor staticAcc;
  @init protoMethod() {}
}
console.log('=== Instantiation ===');
const inst = new C();

Configuration file name

babel.config.json

Configuration

{
  "plugins": [
    ["@babel/plugin-proposal-decorators", {"version": "2022-03"}]
  ]
}

Current and expected behavior

Actual output:

staticAcc function
protoMethod function
=== Instantiation ===

Expected output:

staticAcc function
=== Instantiation ===
protoMethod object

With the accessor commented out, the output is:

=== Instantiation ===
protoMethod object

Environment

  System:
    OS: macOS 12.6
  Binaries:
    Node: 18.10.0 - /usr/local/bin/node
    npm: 8.19.2 - /usr/local/bin/npm
  npmPackages:
    @babel/core: ^7.19.3 => 7.19.3 
    @babel/node: ^7.19.1 => 7.19.1 
    @babel/plugin-proposal-decorators: ^7.19.3 => 7.19.3 

Possible solution

No response

Additional context

@babel-bot
Copy link
Collaborator

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

@JLHwung
Copy link
Contributor

JLHwung commented Oct 18, 2022

@rauschma Thanks for the detailed report! It will be fixed in #15059.

@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 Jan 19, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 19, 2023
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 Spec: Decorators
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants