-
Notifications
You must be signed in to change notification settings - Fork 110
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
Method decorators in TypeScript break Closure Compiler minification #241
Comments
If you still have |
Not every project out there using tsickle also uses angular, which means that not everyone will run their code through ngc. |
Our plan: tsickle doesn't support decorators. Angular does its own thing with decorators, separate from tsickle. |
Polymer 3 is a heavy user of decorators, and is written in Typescript. Does this mean tsickle won't be usable on Polymer projects? It would help to clarify what "tsickle doesn't support decorators" means in practice. |
@rictic What should tsickle be doing about polymer 3 decorators? |
The status quo is working today for Polymer + closure compiler. Be sure to pass |
Great, thanks. |
To restate the position here: tsickle does not explicitly support decorators, so Closure will do what it does with them. tsickle will not make decorators correct in the presence of renaming, so that falls on user code. Our position is that you should not use decorators, as they have been dropped by TS upstream as well (there are open bugs in the codegen for them that upstream will not fix). |
+1 Polymer and LitElement users having issues with decorators + tsickle can reach out to me or others on the Polymer team. |
@evmar could you provide links to some of those bugs? |
@marcfallows I don't remember the bug offhand, but it was in some pattern of how Angular used decorators where TS would use the wrong reference. I think this is why they moved to a model of removing the decorators before TS compiles them. You can look through I think I read that TS is interested their decorators following the spec, so I expect they will resume work on reimplementing them with the new different behavior once the spec is done. |
I'm extending this discussion over here from my Closure Compiler issue. The summary is as follows:
I have an
AuthStore
class that declares agetUser
method that has an@autoSubscribe
decorator. TypeScript compiles this by adding this after the class definition:After minification via Closure Compiler, my
getUser
is namedd
, but the call to__decorate
still contains"getUser"
. This obviously fails.@mprobst and @ChadKillingsworth suggest using
goog.reflect
to solve the issue like so:Is it possible that tsickle could extend support to method decorators to emit something like this?
The text was updated successfully, but these errors were encountered: