-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
undefined
is passed for the "context.metadata" field in a decorator metadata
#7957
Comments
I have investigated the issue a bit more and found out that the decorators' metadata doesn't work at all.
|
Mmm... it does not for me. I have copy-pasted the code from output to a plain javascript file and when executed with Node.js got the same results. Still PS: I have also upgraded all related dependencies so all the tests I run are based on the latest versions of
|
If so, please provide a minimal reproduction, ideally with the swc playground. |
@kdy1 Ahh, you don't see the output, as I am using Let me start from scratch with (this time) valid and a bit more descriptive reproduction: Issue reproduction / Githubhttps://github.com/arklanq/swc-issue-7957-reproduction Issue reproduction / CodeSandboxhttps://codesandbox.io/p/sandbox/crazy-mopsa-n9tgzv?welcome=true Issue reproduction / SWC PlaygroundI cannot create valid issue reproduction on SWC Playground, because I need to import Please make sure to read |
I looked at the spec and seems like the babel team just didn't implement it yet. https://github.com/tc39/proposal-decorators I think that's because it is not worth the cost, but well... I'll reopen this issue for now. |
undefined
is passed for the "context.metadata" field in a decorator metadata
@kdy1 This is a fairly new feature that was introduced recently in TypeScript 5.2, so maybe Babel team is not rushing to implement it now. Anyway, it is a stage 3 proposal so we can be almost sure the feature will land soon in ECMA standard so we should not ignore it. Some reference: |
There are enormous amount of tasks that has higher priority than 100% parity with the specification. |
Sure, I'll keep an eye on the issue then. |
**Description:** This PR implements the [decorator metadata](https://github.com/tc39/proposal-decorator-metadata) proposal, that is now at Stage 3. As the decorator metadata proposal is a small extension of the decorator proposal and is not possible to compile the metadata without transpiling decorators, I opted to implement it into the existing decorator transformer (and helper) **Related issue:** - Closes #7957
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. |
Describe the bug
When switching from tsc to swc to transpile TypeScript to JavaScript code I have noticed that
context.metadata
argument for decorators becomes undefined.More context:
core-js/proposals/decorator-metadata-v2.js
.Input code
Config
Playground link
https://play.swc.rs/?version=1.3.74&code=H4sIAAAAAAAAA02QwU7EIBCG7zzF3BYSw95b22jWR%2FBm9jCF6aa6Dg1MdzXGd3eENTHhwPzwffxBPleCwxlLecZ8IoEBcCqSMQgwXcF67%2FWgdLDxG6crvxwdDOPf1BszbxxkSQwLv1KQ%2ByoD%2BhDiWP6rR2sApG67lt9pEBKLXr4lTxRSRkn50OJmG43r4JKWCF%2BNKOlMPtK0neyN9%2B8kGFHQ9bDfa71I88IUzbcxD62ZCbXZ47qqRj1zStZVI0Am2TLDbsK86zVRStfvSwKowFA%2FQ1HrjM6%2Bsr35AYrFObg%2BAQAA&config=H4sIAAAAAAAAA22QPQ%2BCQAyGd3%2FFpbMaQQdjoouLLo7uDRSDwt2lrQZC%2BO8efiAap7bv0%2B9mZAycJYGVaYIbAo8sxH0cFKmtYhUU0NqTJJx7hfGbqnQow0Ko11JKHKM6loCUrwNSWyzzZF96x%2FoF26cBZbSSOS6HK%2FQNj8SSO9stE8%2FieDKbw3c5VUpssdhR4elnPlyI%2FLZAkQOWNGSPaiB7%2B%2FxBkU%2BkXRJYl5LZrE20nEaL17y%2Fl3SdRu0dcYStD1QBAAA%3D
SWC Info output
Expected behavior
With tsc:
Actual behavior
With swc:
Version
1.3.82
Additional context
Maybe this could be helpful:
microsoft/TypeScript#55453
The text was updated successfully, but these errors were encountered: