Closed e111077 closed 1 year ago
This isn't implemented yet, but it is necessary
I also have need for decorators. Not in components but in the API side. I'm using https://typegraphql.com/.
@dylan-conway implemented this in #1445 and it will be available in Bun v0.2.3. To try it sooner, run this once the build completes:
bun upgrade --canary
Wondering if this implementation will have consideration for the eventual migration to stage 3 decorators. I believe the TS team has a "way out" with the experimentalDecorators: false
flag + target: 'es2023'
(or whatever year) in tsconfig.json
. AFAICT there is no way to toggle this in Bun, or if this has been discussed already on y'all's end
Wondering if this implementation will have consideration for the eventual migration to stage 3 decorators. I believe the TS team has a "way out" with the experimentalDecorators: false flag + target: 'es2023' (or whatever year) in tsconfig.json. AFAICT there is no way to toggle this in Bun, or if this has been discussed already on y'all's end
Bun will definitely support JS decorators in the future (likely before JSC implements it in the engine).
Right now TS decorators are only enabled if TypeScript is enabled. We could change that to follow the experimentalDecorators
flag matching TypeScript's behavior. We do read tsconfg.json so it wouldn't be a huge thing. That being said, Bun wants to encourage a workflow where the developer doesn't need separate build & separate run steps. We might disable reading tsconfig.json for dependencies (it causes a few issues), which would break decorators support if decorators must be explicitly enabled.
I think we should visit this shortly before we implement JS decorators in Bun
I'm interested in using the stage 3 version as well. I haven't missed anything, have I? Is this still not possible in Bun?
Heya, I see it's already documented as not working, but I'd like to still open an issue to request TS Decorator support to hopefully put it on the roadmap.
It's used quite often in Web Component-based libraries which have to use a JS class extend of
HTMLElement
.Additionally, it's common to generate accessors in decorators on class fields, so also supporting
useDefineForClassFields: "false"
would be helpful as well.Repro here:
index.html
my-element.ts
tsconfig.json