Skip to content

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

Closed

Description

@jordimarimon

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

Activity

  1. alan-agius4 commented on Apr 22, 2025

    @alan-agius4
    Contributor

    This seem a regression caused by angular/angular-cli@6f913ad

  2. added theissue type on Apr 22, 2025
  3. transferred this issue fromangular/angular-clion May 8, 2025
  4. added theissue type on May 8, 2025
  5. added
    area: compiler
    on May 8, 2025
  6. added this to the needsTriage milestone on May 8, 2025
  7. JeanMeche commented on Jul 10, 2025

    @JeanMeche
    Member

    I believe this has been fixed now.

  8. angular-automatic-lock-bot commented on Aug 12, 2025

    @angular-automatic-lock-bot

    This issue has been automatically locked due to inactivity.
    Please file a new issue if you are encountering a similar or related problem.

    Read more about our automatic conversation locking policy.

    This action has been performed automatically by a bot.

  9. locked and limited conversation to collaborators on Aug 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: compilerfreq1: lowstate: has PRtype: bug/fix

    Type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions