Skip to content

signal inputs seem to not work with numberAttribute (generic is needed, or needs inference) #53969

@cipchk

Description

@cipchk

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

core

Is this a regression?

Yes

Description

@Directive({
  selector: 'auto-focus',
  standalone: true,
})
export class AutoFocus {
  delay = input<number>(300, { transform: numberAttribute });
}

Throw error:

Error in src/main.ts (10:32)
Type '(value: unknown, fallbackValue?: number | undefined) => number' is not assignable to type 'undefined'.

Please provide a link to a minimal reproduction of the bug

https://stackblitz.com/edit/stackblitz-starters-fv1yrc?file=src%2Fmain.ts

Please provide the exception or error you saw

No response

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

Angular CLI: 17.1.0
Node: 18.16.0
Package Manager: yarn 4.0.2
OS: darwin x64

Angular: 17.1.0
... animations, cdk, cli, common, compiler, compiler-cli, core
... elements, forms, language-service, platform-browser
... platform-browser-dynamic, platform-server, router
... service-worker, ssr

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1701.0
@angular-devkit/build-angular   17.1.0
@angular-devkit/core            17.1.0
@angular-devkit/schematics      17.1.0
@schematics/angular             17.1.0
ng-packagr                      17.1.0
rxjs                            7.8.1
typescript                      5.3.3
zone.js                         0.14.3

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions