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
Angular Non AOT compiler doesn't emit class decorators in specific cases #39574
Comments
I think that this is more related to the CLI processing than the framework compilation. But @alan-agius4 is looking into it. |
Actually it is caused by a transform ( |
There is a compiler transform that downlevels Angular class decorators to static properties so that metadata is available for JIT compilation. The transform was supposed to ignore non-Angular decorators but it was actually completely dropping decorators that did not conform to a very specific syntactic shape (i.e. the decorator was a simple identifier, or a namespaced identifier). This commit ensures that all non-Angular decorators are kepts as-is even if they are built using a syntax that the Angular compiler does not understand. Fixes angular#39574
There is a compiler transform that downlevels Angular class decorators to static properties so that metadata is available for JIT compilation. The transform was supposed to ignore non-Angular decorators but it was actually completely dropping decorators that did not conform to a very specific syntactic shape (i.e. the decorator was a simple identifier, or a namespaced identifier). This commit ensures that all non-Angular decorators are kepts as-is even if they are built using a syntax that the Angular compiler does not understand. Fixes angular#39574
Thanks for the quick response. |
Hi, will this be fixed for v9 as well ? Downlevel transformer in v9 locates in CLI repo but I don't see any PRs to fix this issue there for v9. |
The PR for this issue will land on master, RC and patch branches. The patch branch is currently 10.2.x. |
…ng (#39577) There is a compiler transform that downlevels Angular class decorators to static properties so that metadata is available for JIT compilation. The transform was supposed to ignore non-Angular decorators but it was actually completely dropping decorators that did not conform to a very specific syntactic shape (i.e. the decorator was a simple identifier, or a namespaced identifier). This commit ensures that all non-Angular decorators are kepts as-is even if they are built using a syntax that the Angular compiler does not understand. Fixes #39574 PR Close #39577
…ng (#39577) There is a compiler transform that downlevels Angular class decorators to static properties so that metadata is available for JIT compilation. The transform was supposed to ignore non-Angular decorators but it was actually completely dropping decorators that did not conform to a very specific syntactic shape (i.e. the decorator was a simple identifier, or a namespaced identifier). This commit ensures that all non-Angular decorators are kepts as-is even if they are built using a syntax that the Angular compiler does not understand. Fixes #39574 PR Close #39577
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
🐞 bug report
Affected Package
Angular Non AOT compiler (Jit Mode)
Is this a regression?
Yes, the very same scenario works on Angular 8.x
Description
Given that AOT is disabled (
"aot": false
in angular.json)Given a class that is responsible of configuring "class decorators", if I decorate a regular typescript class with a decorator generated by that class, the compiled javascript doesn't emit the class decorator properly.
🔬 Minimal Reproduction
https://github.com/ratoaq2/angular-non-aot-class-decorator
Just start the app:
npm install
npm start
access http://localhost:4200
You should see:
Hello Decorated Foobar!
But you see:
Hello foobar!
If you enable
"aot": true
, it works correctly. But that's not an option because I also face this issue in my spec tests where I can't enableaot
.🔥 Exception or Error
No exception or error
🌍 Your Environment
Angular Version:
Anything else relevant?
It doesn't seem to be a typescript issue
The text was updated successfully, but these errors were encountered: