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

TypeScript-Bug-ES2022 : Optional property should be not show #8160

Closed
sunrabbit123 opened this issue Oct 20, 2023 · 2 comments
Closed

TypeScript-Bug-ES2022 : Optional property should be not show #8160

sunrabbit123 opened this issue Oct 20, 2023 · 2 comments
Labels

Comments

@sunrabbit123
Copy link

Describe the bug

property x should be not show

This worked fine until 1.3.39, when the
since then.

Of course, i only checked with the playground.

tsc
swc 1.3.40
swc 1.3.39

Input code

class A {
    public x?: string;
    constructor(init){
        Object.assign(this, init);
    }
}

class B extends A {
    public b?: string;
}

console.log(new B());

Config

{
  "jsc": {
    "parser": {
      "syntax": "typescript",
      "tsx": false
    },
    "target": "es2022",
    "loose": false,
    "minify": {
      "compress": false,
      "mangle": false
    }
  },
  "module": {
    "type": "es6"
  },
  "minify": false,
  "isModule": false
}

Playground link (or link to the minimal reproduction)

https://play.swc.rs/?version=1.3.40&code=H4sIAAAAAAAAA2WNQQqEMAxF9z1Fli0MHkAXw3iBOcM0hpqhpIONKIh3t9aNMH%2BXz8t%2FGD85wws2AyW%2F2UdGWJ8tZJ1YQldrTFLOGTVNloXVXfSZt%2F8SalNGOIjVkfMDKnJ97mY3BqujB1qVZPiz%2BZvtpIssRWpiClZogd461x3E1VqbpwAAAA%3D%3D&config=H4sIAAAAAAAAA1VPOw7DIAzdcwrkuUPF0KF36CEQdSIqfsKuVBTl7oUAabPZ7%2BP3vE5CwIs03MVaxrJElQjTsReEsmf1KQhwjkg6mchwGSxTpWZlCXdoawywSgtydSHJq5TdATYEwuHomDPezPk%2FUwcXExKdhVWq%2FGLxnDj1VHDh%2Bd7J%2Fkvt2xrc4CcaYcdhMPQYznZ2%2BwKZmnC1GAEAAA%3D%3D

SWC Info output

Noop

I found out while working on the playground.

Expected behavior

I expected next code

"use strict";
class A {
    constructor(init) {
        Object.assign(this, init);
    }
}
class B extends A {
}
console.log(new B());

Actual behavior

x should be not show, but x is exists

class A {
    x;
    constructor(init){
        Object.assign(this, init);
    }
}
class B extends A {
    b;
}
console.log(new B());

Version

1.3.40

Additional context

No response

@sunrabbit123 sunrabbit123 changed the title Bug: Optional property should be not show TypeScript-Bug-ES2022 : Optional property should be not show Oct 20, 2023
@magic-akari
Copy link
Member

@kdy1 kdy1 closed this as not planned Won't fix, can't repro, duplicate, stale Oct 20, 2023
@swc-bot
Copy link
Collaborator

swc-bot commented Nov 20, 2023

This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@swc-project swc-project locked as resolved and limited conversation to collaborators Nov 20, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Development

No branches or pull requests

4 participants