Skip to content

Strange behavior when migrating input with more than 1 usage in a method #63018

Closed

Description

@Armenvardanyan95

Command

generate

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

No response

Description

When I migrate a project to signals with the ng generate @angular/core:signal-input-migration command, the presence of certain inputs and manipulations on them cause very strange changed in the code by the migration, namely, the removal of the this keyword, which immediately causes a broken build, even when using the "safe" option instead of "best effort"

Minimal Reproduction

To reproduce this, have a component that declares a decorator-based input of type any named "model", and then manipulate the underlying properties in some methods:

export class TestMigrationComponent {
  @Input() public model: any;
  // =============== API Calls ===============

  public onSaveClick(): void {
      this.model.requisitionId = 145;
      this.model.comment = 'value';
      this.model.status = 8;
      this.model.finilizeReasonId = 4
  }

}

After the migration script runs, it suddenly leaves us with this:

export class TestMigrationComponent {
  public readonly model = input<any>();
  // =============== API Calls ===============

  public onSaveClick(): void {
      model.requisitionId = 145;
      model.comment = 'value';
      model.status = 8;
      model.finilizeReasonId = 4
  }

}

As we can see, this is removed, turning the command into a reference to a non-existent global variable, now breaking the build. This doesn't happen when the input has any other name (as far as I can tell), which makes me wonder if this is somehow connected to model signals. In other cases the migration simply skips the input as intended.

Exception or Error


Your Environment

Angular CLI: 20.1.0
Node: 24.0.0
Package Manager: npm 11.3.0
OS: win32 x64

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

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.2001.0
@angular-devkit/build-angular   20.1.0
@angular-devkit/core            20.1.0
@angular-devkit/schematics      20.1.0
@schematics/angular             20.1.0
rxjs                            7.8.2
typescript                      5.8.3
zone.js                         0.15.0

Anything else relevant?

No response

Activity

  1. added
    area: migrations
    on Aug 6, 2025
  2. added this to the needsTriage milestone on Aug 6, 2025
  3. added theissue type on Aug 6, 2025
  4. added
    open for contributions
    on Aug 6, 2025
  5. JeanMeche commented on Aug 6, 2025

    @JeanMeche
    Member

    The expected output should be

      public onSaveClick(): void {
          const model = this.model();
          model.requisitionId = 145;
          model.comment = 'value';
          model.status = 8;
          model.finilizeReasonId = 4
      }
    
  6. changed the title [-]Strange behavior when migrating input named "model"[/-] [+]Strange behavior when migrating input with more than 1 usage in a method[/+] on Aug 6, 2025
  7. ArifUcar commented on Aug 14, 2025

    @ArifUcar
  8. added 8 commits that reference this issue on Oct 11, 2025
    2a8cb1e
    87bf24e
    14188bc
    24ddea0
    d0010e7
    b7ce35f
    f7624eb
    a181aac
  9. added a commit that references this issue on Oct 13, 2025
    554573e
  10. added a commit that references this issue on Oct 13, 2025
    e99bbd3
  11. angular-automatic-lock-bot commented on Nov 13, 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.

  12. locked and limited conversation to collaborators on Nov 13, 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: migrationsopen for contributions

    Type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions