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

Reflect metadata "design:type" incorrect for accessors #3998

Closed
lolopinto opened this issue Mar 13, 2022 · 6 comments
Closed

Reflect metadata "design:type" incorrect for accessors #3998

lolopinto opened this issue Mar 13, 2022 · 6 comments

Comments

@lolopinto
Copy link

Describe the bug

import "reflect-metadata";
class Foo {
  @bar()
  get fullName(): string {
    return "";
  }
}

function bar() {
  return function (target, propertyKey, descriptor) {
    console.debug("ss");
    let typeMetadata = Reflect.getMetadata(
      "design:type",
      target,
      propertyKey,
    );
    console.debug(typeMetadata);
  };
}

new Foo();

results in

ts-node src/foo.ts
ss
[Function: String]
 ts-node --swc src/foo.ts
ss
[Function: Function]

Input code

No response

Config

No response

Playground link

https://play.swc.rs/?version=1.2.151&code=H4sIAAAAAAAAA1VQQWrEMAy8%2BxWDTw6k%2B4ANhZ56Kd1Df%2BB1lGBw7CArlFDy9zquW7Y3aTQzGskva2KBZpoCOXlaSOxoxepBuWBzxmtK%2BFLAy92y6Uoxk2DaQrjZhUx3RRb2ca4cgEk2jtBFDhzqUGraohOfIqq%2B0hrpb2LEcnHtsXJaiWV%2Fo73HSNmxXyVx18xdijkFuox032ajc9bdUAehRJJ9pfcWHs%2F4%2BLnnUnx%2FUVO5gC7Ofo7XU6H7BrYIrXsMUqG26H%2BCx5WVcAznxZE%2Bz6%2BZAn0DS8cRFF4BAAA%3D&config=H4sIAAAAAAAAA02NSwrDMAxE76J1FiFLr7vNIYQtBwf%2FkBSoCb177aSl3QnNmzcn7GLBnFCRhXhc0rLiEwxoqySWQ1WYwJEtjFpYwCgf9JpAGbP4wmm0Im1o2%2BNL3dBfbSVFh4q%2FNvJG2mdIlnmZob9ScUekYRvTPbIlpZJ3ucKQg29gPEbp4iDrh758b3M%2FIFXIAAAA

Expected behavior

I expect the design:type returned to match non-swc and should indicate [Function: String] in this scenario

Actual behavior

The design:type returned doesn't include the return type

Version

1.2.154

Additional context

No response

@kdy1 kdy1 added this to the Blocked by type checker milestone Mar 13, 2022
@lolopinto
Copy link
Author

@kdy1 am i to understand that anything added to that milestone isn't going to be fixed anytime soon?

@lolopinto
Copy link
Author

hi @kdy1, I see that #4496 was committed but a bunch of these decorator issues are still open and I still repro them on the latest version of @swc/core

Should they be fixed yet?

@kdy1
Copy link
Member

kdy1 commented May 27, 2022

No. #4496 is not related to this at all

@lolopinto
Copy link
Author

ok, thanks! do you have a sense of when this class of issues would be fixed?

@kdy1
Copy link
Member

kdy1 commented Jan 30, 2024

Closing as the stc is now abandoned. #571 (comment)

@kdy1 kdy1 closed this as not planned Won't fix, can't repro, duplicate, stale Jan 30, 2024
@swc-bot
Copy link
Collaborator

swc-bot commented Feb 29, 2024

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 Feb 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Development

No branches or pull requests

3 participants