Skip to content

Unable to use JS decorators in private methods with the development build #30139

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

Open
1 task done
jordimarimon opened this issue Apr 22, 2025 · 1 comment
Open
1 task done
Labels
area: @angular/build freq1: low Only reported by a handful of users who observe it rarely severity5: regression type: bug/fix

Comments

@jordimarimon
Copy link

jordimarimon commented Apr 22, 2025

Command

build

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

19.2.6

Description

When building with the default development configuration, if one is using JS decorators in a private method (not the experimental ones from TypeScript, experimentalDecorators: false) gets the following error:

Image

If the method is public, the error doesn't happen.

This error doesn't happen in version 19.2.6.

Minimal Reproduction

Reproduction url: https://github.com/jordimarimon/angular-cli-js-decorator

The application has been created using the following command:

npx @angular/cli new test-app --experimental-zoneless --inline-style --inline-template --minimal --skip-git --skip-install --skip-tests --standalone --strict

There are only two additional files:

  • src/app/app.service.ts
  • src/app/debounce.ts

Run the command npx ng build --configuration=production and there shouldn't be any error.

Now run the command npx ng build --configuration=development and there should be an error.

If you downgrade to version 19.2.6 both commands run without any error.

Exception or Error

✘ [ERROR] Expected identifier but found "#foo"

    src/app/app.service.ts:31:20:
      31 │     }], () => [], { #foo: [] }); })();
         ╵                     ~~~~

Your Environment

_                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/


Angular CLI: 19.2.8
Node: 22.12.0
Package Manager: npm 11.3.0
OS: linux x64

Angular: 19.2.7
... common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1902.8
@angular-devkit/build-angular   19.2.8
@angular-devkit/core            19.2.8
@angular-devkit/schematics      19.2.8
@angular/cli                    19.2.8
@schematics/angular             19.2.8
rxjs                            7.8.2
typescript                      5.7.3
zone.js                         0.15.0

Anything else relevant?

No response

@alan-agius4 alan-agius4 added type: bug/fix freq1: low Only reported by a handful of users who observe it rarely severity5: regression area: @angular/build labels Apr 22, 2025
@alan-agius4
Copy link
Collaborator

This seem a regression caused by 6f913ad

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: @angular/build freq1: low Only reported by a handful of users who observe it rarely severity5: regression type: bug/fix
Projects
None yet
Development

No branches or pull requests

2 participants