-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
support typescript@5 decorator #4122
Comments
Problems with typescript 5 I get:
|
This issue is with |
Is it being planned tbd? |
Waiting to support new typescript 5 decorators |
I am waiting too, please fix this |
i think thats because internally they are treated as experimental decorators (that behind the "experimentalDecorators" flag) which also has the target/class/function as the first parameter. |
I can confirm that when using This happens when the
|
Is there any workaround? |
@Spenhouet, not that I know of, since Bun is generating this. Interestingly, for my libraries, I rolled back from TS5 Decorators to TS4 experimental decorators. Here are the two main reasons:
Also, the decorators in the "can I use" matrix have no implementation plan, so we will have to do the shimming for many years to come (possibly for the next 5 years). All things considered, while sticking with an old spec always feels odd, I think the net value of sticking with TS4 experimental decorators might be the better option. They are less intrusive in the code and offer better support. Regardless, it would be great for Bun to follow the |
Same problem here.
While waiting I'm transpilling with tsc and using bun to run the generated .js files. |
Deno contributors have implemented this in January btw. |
@pokatomnik Do you know if they shim js |
That's what typescript does. Not deno itself |
experimentalDecorators should not be turned of! They're an old standard of that proposal, the new one is on by default! |
I would also concur with @Autumnlight02 that the experimentalDecorators need to be preserved. It's quite involved to move from one to another, so preserving both is very useful. |
Just to clear up ambiguity Bun will support both ES decorators and TS decorators. We just haven’t gotten around to implementing this in the transpiler yet (and JSC hasn’t in the engine yet) |
related;
|
Seems like #6051 is related? Just ran into an issue with
when running a simple build script: import { Glob } from "bun";
const glob = new Glob("{src,src-webcomponents}/**/*.{ts,js}");
const files = [];
for await (const file of glob.scan()) {
files.push(file);
}
const result = await Bun.build({
entrypoints: files,
outdir: "./.build",
splitting: true,
minify: true,
});
if (!result.success) {
for (const message of result.logs) {
console.error(message);
}
} |
Anyone planning to use or implement stage 3 decorators will find this link very useful. As you can see, no one has found a bulletproof solution yet, but esbuild and babel seem to work smoothly for most cases. https://github.com/evanw/decorator-tests Considering that Bun's bundler API is inspired heavily by esbuild Migrating to Bun's bundler from esbuild should be relatively painless, addressing this gap would be a significant step and would definitely put Bun in a favorable position for those seeking this feature. |
bumping this as its been a while |
deno has native support for it as far as i know as well, no hacky layers involved |
To my knowledge, even though we might not notice it, it seems that Deno utilizes SWC behind the scenes. https://choubey.gitbook.io/internals-of-deno/architecture/tsc |
What version of Bun is running?
v0.7.3
What platform is your computer?
Linux 5.19.0-50-generic x86_64 x86_64
What steps can reproduce the bug?
package.json
tsconfig.json
4122.ts
What is the expected behavior?
What do you see instead?
Additional information
https://www.typescriptlang.org/docs/handbook/release-notes/typescript-5-0.html#decorators
The text was updated successfully, but these errors were encountered: