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

Type alias is not resolved on decorator metadata. #2703

Closed
hisomura opened this issue Nov 9, 2021 · 3 comments
Closed

Type alias is not resolved on decorator metadata. #2703

hisomura opened this issue Nov 9, 2021 · 3 comments

Comments

@hisomura
Copy link

hisomura commented Nov 9, 2021

Describe the bug

When using type alias, decorator metadata is not resolved.

Input code

import 'reflect-metadata';

const COL_KEY = Symbol('col');

type Currency = 'usd' | 'eur' | 'yen'
const column = () => {
  return (object: any, key: string) => {
    Reflect.defineMetadata(COL_KEY, 'value', object, key);
  };
};

class User {
  @column() currency!: Currency;
}

console.log(Reflect.getMetadata('design:type', User.prototype, 'currency')); // [Function: Object]
// should be string

Config

{
    "jsc": {
        "parser": {
            "syntax": "typescript",
            "tsx": false,
            "decorators": true,
            "dynamicImport": false
        },
        "transform": {
            "legacyDecorator": true,
            "decoratorMetadata": true
        }
    },
    "module": {
        "type": "commonjs"
    }
}

Playground link

No response

Expected behavior

String should have been emitted.

Version

@swc/core: 1.2.107

Additional context

This sample code was written with #1421 as a reference.
This issue looks like related to #2461.

@hisomura hisomura added the C-bug label Nov 9, 2021
@sannajammeh

This comment was marked as spam.

@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

4 participants