You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(jit): @Inject / @Optional / @Attribute on a class member are dropped instead of lowered to propDecorators #522
In JIT mode (jit: true), OXC drops @angular/core member decorators that are not field decorators. Examples are @Inject, @Optional, @Attribute, @Self, @Host, and @Component on a member. ngtsc's JIT transform (downlevel_decorators_transform) lowers every member decorator imported from @angular/core into static propDecorators. It does not check the decorator name.
The code says this on purpose (component/transform.rs, near ANGULAR_DECORATOR_NAMES):
// Angular non-field decorators (e.g. @Inject on a member) are silently dropped// since they have no meaningful effect on members.
Angular's own JIT compiler ignores these entries. But code that reads propDecorators (for example ReflectionCapabilities.propMetadata, or custom tools) sees a different result. The output is not 1:1 with ngtsc.
Lower every member decorator imported from @angular/core into propDecorators, like ngtsc's isAngularDecorator (decorator.import.from === "@angular/core"). Keep the decorator order. A mixed member (@Input() @Inject(T) x) must keep both entries. Today OXC keeps only Input.
Found during the review of #504. #504 already makes the member decorator check import-aware: a same-named decorator from another module stays in __decorate().
Activity