FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Fix SWC support with stage 3 decorators by MuTsunTsai · Pull Request #2136 · TypeStrong/ts-node · GitHub

Fix SWC support with stage 3 decorators - #2136

Open
MuTsunTsai wants to merge 2 commits into
TypeStrong:mainfrom
MuTsunTsai:hotfix/swc-decorator
Open

Fix SWC support with stage 3 decorators#2136
MuTsunTsai wants to merge 2 commits into
TypeStrong:mainfrom
MuTsunTsai:hotfix/swc-decorator

Conversation

Copy link
Copy Markdown

Since TypeScript 5.0, stage 3 decorators had become the default while experimentalDecorators had become the legacy standard. However, with SWC enabled, ts-node doesn't work correctly with stage 3 decorators. This PR fixes the config pass to SWC to make it things work as it should.

Note: This part of the SWC config has been there since v1.3.47, so there's no need the change the dependency specifications.

Comment thread src/transpilers/swc.ts
decoratorMetadata: emitDecoratorMetadata,
legacyDecorator: true,
legacyDecorator: experimentalDecorators,
decoratorVersion: experimentalDecorators ? '2021-12' : '2022-03',

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality
Suggested change
decoratorVersion: experimentalDecorators ? '2021-12' : '2022-03',
decoratorVersion: experimentalDecorators ? '2021-12' : '2023-11',

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Where did you get that 2023-11 from? SWC doesn't have that option: https://swc.rs/docs/configuration/compilation#jsctransformdecoratorversion

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Where did you get that 2023-11 from? SWC doesn't have that option: https://swc.rs/docs/configuration/compilation#jsctransformdecoratorversion

I saw this value in SWC error message & Babel document, maybe it hasn't been implemented.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

no it hasn't

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants


Back | FazBrowse Home | New Git URL