Skip to content

signal-input-migration on transform without explicit typing #63541

@Lysoun

Description

@Lysoun

Which @angular/* package(s) are the source of the bug?

core

Is this a regression?

No

Description

When I run the signal-input-migration on an app containing an @input() using a transform function without explicit typing, for example:

@Input({transform: value1 => value1 * 10})
public value: number = 0;

The migration does throws errors in safe migration mode:

➜  src git:(main) npx @angular/cli@20 generate @angular/core:signal-input-migration                             
✔ Which directory do you want to migrate? ./
✔ Do you want to migrate as much as possible, even if it may break your build? No
    Preparing analysis for: tsconfig.app.json...
    Scanning for inputs: tsconfig.app.json...
/src/app/my-component/my-component.ts: Error: FatalDiagnosticError: Code: 1010, Message: Input transform function first parameter must have a type
  Value could not be determined statically.
    Preparing analysis for: tsconfig.spec.json...
    Scanning for inputs: tsconfig.spec.json...
/src/app/my-component/my-component.ts: Error: FatalDiagnosticError: Code: 1010, Message: Input transform function first parameter must have a type
  Value could not be determined statically.
    
    Processing analysis data between targets...
    
    Running migration for: tsconfig.app.json...
/src/app/my-component/my-component.ts: Error: FatalDiagnosticError: Code: 1010, Message: Input transform function first parameter must have a type
  Value could not be determined statically.
    Running migration for: tsconfig.spec.json...
/src/app/my-component/my-component.ts: Error: FatalDiagnosticError: Code: 1010, Message: Input transform function first parameter must have a type
  Value could not be determined statically.
    
    Successfully migrated to signal inputs 🎉
      -> Migrated 1/1 inputs.
UPDATE src/app/my-component/my-component.ts (276 bytes)

but still migrates the given input, erasing its transform function:

import {Component, input} from '@angular/core';

@Component({
  selector: 'app-my-component',
  imports: [],
  templateUrl: './my-component.html',
  standalone: true,
  styleUrl: './my-component.css'
})
export class MyComponent {
  public readonly value = input<number>(0);
}

Since the app's behaviour is changed doing so, I would expect the migration to not do anything on this @Input and, using the option --insert-todos, indicate what the action to fix the issue would be (add explicit typing on the transform function)

Please provide a link to a minimal reproduction of the bug

https://github.com/Lysoun/angular-signal-input-migration-transform-issue

Please provide the exception or error you saw

Error: FatalDiagnosticError: Code: 1010, Message: Input transform function first parameter must have a type

Please provide the environment you discovered this bug in (run ng version)

Angular CLI: 20.2.1
Node: 22.16.0
Package Manager: npm 10.9.2
OS: darwin arm64
    

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

Package                      Version
------------------------------------
@angular-devkit/architect    0.2002.1
@angular-devkit/core         20.2.1
@angular-devkit/schematics   20.2.1
@angular/build               20.2.1
@angular/cli                 20.2.1
@schematics/angular          20.2.1
rxjs                         7.8.2
typescript                   5.9.2
zone.js                      0.15.1

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: migrationsIssues related to `ng update`/`ng generate` migrations

    Type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions