Skip to content

fix(jit): lower non-Angular decorators via __decorate#204

Merged
Brooooooklyn merged 1 commit intovoidzero-dev:mainfrom
ashley-hunter:fix-custom-decorators
Apr 2, 2026
Merged

fix(jit): lower non-Angular decorators via __decorate#204
Brooooooklyn merged 1 commit intovoidzero-dev:mainfrom
ashley-hunter:fix-custom-decorators

Conversation

@ashley-hunter
Copy link
Copy Markdown
Contributor

When @oxc-angular/vite encounters a class with both Angular and non-Angular decorators like @Injectable() and NGXS @State, @selector, or @action, it must lower all decorators – not just Angular ones – when converting class declarations to class expressions.

This PR:

  • Lowers non-Angular class decorators into ClassName = __decorate([…], ClassName) calls.
  • Lowers non-Angular member decorators into __decorate([…], ClassName.prototype, “memberName”, null|void 0) calls, using null for methods/accessors and void 0 for properties, matching TypeScript’s tsc output.
  • Preserves the correct emission order: instance members first, then static members, and finally class-level __decorate, matching TypeScript’s behaviour.
  • Excludes all Angular decorators (@component, @directive, @input, @Inject, etc.) from __decorate lowering since Angular handles these through propDecorators and ctorParameters.
  • Consolidates the member decorator extraction into a single-pass function to reduce code duplication.

When a class has both Angular decorators (e.g. @Injectable) and
non-Angular decorators (e.g. NGXS @State, @selector, @action),
lower all decorators when converting class declarations to class
expressions. Non-Angular member decorators are emitted as __decorate()
calls matching TypeScript's tsc output: null for methods/accessors,
void 0 for properties, instance members before static members.
@ashley-hunter ashley-hunter force-pushed the fix-custom-decorators branch from 8bb6930 to 72b7328 Compare April 1, 2026 22:23
@ashley-hunter ashley-hunter marked this pull request as ready for review April 2, 2026 07:42
@ashley-hunter ashley-hunter changed the title fix(jit): lower non-Angular decorators via __decorate fix: lower non-Angular decorators via __decorate Apr 2, 2026
@Brooooooklyn Brooooooklyn changed the title fix: lower non-Angular decorators via __decorate fix(jit): lower non-Angular decorators via __decorate Apr 2, 2026
@Brooooooklyn Brooooooklyn merged commit bdf7a06 into voidzero-dev:main Apr 2, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants