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]: Parameter properties don't get transformed correctly / are broken #13971

Closed
1 task
danieltroger opened this issue Nov 16, 2021 · 4 comments
Closed
1 task
Labels
i: needs triage outdated A closed issue/PR that is archived due to age. Recommended to make a new issue

Comments

@danieltroger
Copy link

danieltroger commented Nov 16, 2021

馃捇

  • Would you like to work on a fix?

How are you using Babel?

Other (Next.js, Gatsby, vue-cli, ...)

Input code

const API_VERSION = 4;

class Bruh {
  public a_method(): void {
    console.log(this._version);
  }
  public constructor(
    public options: string,
    private readonly _version: number = API_VERSION
  ) {
    console.log(this.options);
  }
}
var instance = new Bruh("馃憖");
instance.a_method();

Configuration file name

babel.config.js

Configuration

module.exports = {
  presets: ["@babel/preset-typescript", "@parcel/babel-preset-env"]
};

馃 Expected Behavior

馃憖 and then 4 is logged to the console.

馃槸 Current Behavior

undefined and then undefined is logged to the console.

Environment

Software Version(s)
Parcel 2.0.0-nightly.912+145bfb82
Node v17.0.1
npm/Yarn 3.1.0
Operating System macOS 10.15.7 (19H1419)
@babel/core 7.16.0

Possible solution

Make so that it works correctly.

Additional context

parcel-bundler/parcel#7313

https://www.typescriptlang.org/docs/handbook/2/classes.html#parameter-properties

@babel-bot
Copy link
Collaborator

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

@danieltroger
Copy link
Author

Wait is this a duplicate of #12066?

@danieltroger
Copy link
Author

danieltroger commented Nov 16, 2021

Bruh fml forreal? How am I supposed to find out that my code breaks because I have some stuff in the wrong order in a config file?

Why can't babel warn or do something that doesn't output broken code?

@JLHwung
Copy link
Contributor

JLHwung commented Nov 18, 2021

Closing this as a duplicate of #12066

@JLHwung JLHwung closed this as completed Nov 18, 2021
@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 Feb 18, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
i: needs triage 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

3 participants