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

transformer: legacy decorators #4047

Closed
Boshen opened this issue Jul 4, 2024 · 11 comments
Closed

transformer: legacy decorators #4047

Boshen opened this issue Jul 4, 2024 · 11 comments
Assignees
Labels
A-transformer Area - Transformer / Transpiler P-high Priority - High

Comments

@Boshen
Copy link
Member

Boshen commented Jul 4, 2024

legacy (typescript --experimentalDecorators)

esbuild: --loader=ts --tsconfig-raw='{"compilerOptions":{"experimentalDecorators":true}}'
tsc: https://www.typescriptlang.org/docs/handbook/decorators.html

@Boshen Boshen added the A-transformer Area - Transformer / Transpiler label Jul 4, 2024
@Boshen Boshen added this to the Transformer Milestone 2 milestone Jul 4, 2024
@Boshen Boshen added A-transformer Area - Transformer / Transpiler and removed A-transformer Area - Transformer / Transpiler labels Aug 8, 2024
@Boshen Boshen removed this from the Transformer Milestone 2 milestone Aug 8, 2024
@Boshen
Copy link
Member Author

Boshen commented Sep 20, 2024

Will reopen when planned.

@Boshen Boshen closed this as not planned Won't fix, can't repro, duplicate, stale Sep 20, 2024
@Boshen
Copy link
Member Author

Boshen commented Oct 12, 2024

experimental decorators and useDefineForClassFields: false is not support by oxc

From rolldown-vite integration.

@OskarLebuda
Copy link

OskarLebuda commented Oct 28, 2024

@Boshen do we have any ETA?

@yyx990803
Copy link

For reference: https://github.com/evanw/decorator-tests

@Boshen Boshen added needs-discussion Requires a discussion from the core team and removed needs-discussion Requires a discussion from the core team labels Nov 25, 2024
@Dunqing Dunqing added the P-high Priority - High label Dec 16, 2024
@OskarLebuda
Copy link

@Boshen @Dunqing do you have guys any kind of ETA?

@Boshen
Copy link
Member Author

Boshen commented Dec 16, 2024

@Boshen @Dunqing do you have guys any kind of ETA?

What are you using oxc for that requires decorators, and which version of decorators do you need?

@OskarLebuda
Copy link

OskarLebuda commented Dec 16, 2024

What are you using oxc for that requires decorators, and which version of decorators do you need?

These are TypeScripts decorators (--experimentalDecorators)

@OskarLebuda
Copy link

@Boshen do you have any updates for this issue? 😞

@Boshen
Copy link
Member Author

Boshen commented Jan 13, 2025

The team has agreed to implement typescript --experimentalDecorators first, which is simpler and what most people use today. Research this week, implementation will probably start next weerk.

@Boshen Boshen assigned overlookmotel and Dunqing and unassigned Boshen and overlookmotel Jan 13, 2025
graphite-app bot pushed a commit that referenced this issue Feb 9, 2025
related: #4047
related: rolldown/rolldown#2296

This is also known as "Experimental Decorator" in `TypeScript` by [experimentalDecorators](https://www.typescriptlang.org/tsconfig/#experimentalDecorators) enabling.

### Testing

- Six tests fail due to [emitDecoratorMetadata](https://www.typescriptlang.org/tsconfig/#emitDecoratorMetadata), as we haven't supported it yet. I found `esbuild` doesn't support it as well.
- A few tests fail due to different unique binding generator
- ...
Dunqing added a commit that referenced this issue Feb 10, 2025
related: #4047
related: rolldown/rolldown#2296

This is also known as "Experimental Decorator" in `TypeScript` by [experimentalDecorators](https://www.typescriptlang.org/tsconfig/#experimentalDecorators) enabling.

### Testing

- Six tests fail due to [emitDecoratorMetadata](https://www.typescriptlang.org/tsconfig/#emitDecoratorMetadata), as we haven't supported it yet. I found `esbuild` doesn't support it as well.
- A few tests fail due to different unique binding generator
- ...
@Boshen Boshen changed the title transformer: decorators transformer: legacy decorators Feb 17, 2025
@Boshen
Copy link
Member Author

Boshen commented Feb 17, 2025

Legacy decorator has been implemented and is being integrated into Rolldown.

A decorator?: DecoratorOptions option has been added to the oxc-transform package.

Stage 3 ecma decorators is tracked in

@Boshen Boshen closed this as completed Feb 17, 2025
@alfaproject
Copy link

alfaproject commented Feb 17, 2025

This is good progress and much appreciated but without emitDecoratorMetadata it's pretty much useless for anyone using TypeScript legacy/experimental decorators because the biggest use case by far is the existing DI libraries out there which all need TS decorator metadata support. Unfortunately, the ECMAScript decorators do not have enough functionality to have decorator based DI containers yet.

There are exceptions like Angular which don't need emitDecoratorMetadata and have their own compiler for DI, and that's why esbuild actually added support for experimentalDecorators but I don't see them using OXC ever. The more likely scenario will probably be Next.js people wanting support for this but like I said, it won't be enough for them either for the exact same reason I mentioned above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-transformer Area - Transformer / Transpiler P-high Priority - High
Projects
None yet
Development

No branches or pull requests

6 participants