We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
The code when transpiling the decorator set in the constructor parameter seems to differ in processing from the code output from tsc.
As an effect of this, I have found that when I transpile and run code that uses the Inversify.js decorator, I get an error.
I have prepared this repository as a sample of what happens. https://github.com/m-doi2/esbuild-ctor-param-decorator-bug-sample
In summary, there are the following differences between esbuild and tsc.
// tsc Ninja = __decorate([ inversify_1.injectable(), __param(0, inversify_1.inject(exports.Symbols.Katana)), __param(1, inversify_1.inject(exports.Symbols.Shuriken)) ], Ninja);
// esbuild __decorate([ __param(0, import_inversify.inject(Symbols.Katana)), __param(1, import_inversify.inject(Symbols.Shuriken)) ], Ninja.prototype, "constructor", 1); Ninja = __decorate([ import_inversify.injectable() ], Ninja);
It seems that tsc sets the parameter decorator directly to the class, while esbuild sets the parameter decorator to the prototype constructor.
Therefore, the following modification will work correctly.
// esbuild (fixed) Ninja = __decorate([ import_inversify.injectable(), __param(0, import_inversify.inject(Symbols.Katana)), __param(1, import_inversify.inject(Symbols.Shuriken)) ], Ninja);
If this helps with this project, I'd be happy.
The text was updated successfully, but these errors were encountered:
Ah, I wasn't aware of constructor behaving this way. Thanks for the report. This is indeed a bug. I can fix this.
constructor
Sorry, something went wrong.
6de420b
Successfully merging a pull request may close this issue.
The code when transpiling the decorator set in the constructor parameter seems to differ in processing from the code output from tsc.
As an effect of this, I have found that when I transpile and run code that uses the Inversify.js decorator, I get an error.
I have prepared this repository as a sample of what happens.
https://github.com/m-doi2/esbuild-ctor-param-decorator-bug-sample
In summary, there are the following differences between esbuild and tsc.
It seems that tsc sets the parameter decorator directly to the class, while esbuild sets the parameter decorator to the prototype constructor.
Therefore, the following modification will work correctly.
If this helps with this project, I'd be happy.
The text was updated successfully, but these errors were encountered: