Which @angular/* package(s) are the source of the bug?
compiler-cli, compiler
Is this a regression?
Yes
Description
When using @Input({transform: transformFn}) and the transformation function is exported from another file, the Angular compiler generates incorrect/mashed up types for the @Input. However, if the transformation function is in the same file as the @Input, everything works as expected. This bug only affects string literal types (I think).
To illustrate the issue, here are screenshots of the incorrect and correct types:
Incorrect types:

Correct types:

Please provide a link to a minimal reproduction of the bug
https://codesandbox.io/p/github/uneknown/reproduce-angular-transform-issue/master
Please provide the exception or error you saw
Please provide the environment you discovered this bug in (run ng version)
Angular CLI: 16.2.0
Node: 16.17.0
Package Manager: npm 8.15.0
OS: linux x64
Angular: 16.2.2
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router
Package Version
---------------------------------------------------------
@angular-devkit/architect 0.1602.0
@angular-devkit/build-angular 16.2.0
@angular-devkit/core 16.2.0
@angular-devkit/schematics 16.2.0
@angular/cli 16.2.0
@schematics/angular 16.2.0
ng-packagr 16.2.1
rxjs 7.8.1
typescript 5.1.6
zone.js 0.13.1
Anything else?
Steps to Reproduce:
- Open CodeSandbox using the link provided above.
- Wait until the sandbox has finished booting up, installed all dependencies, and completed the build.
- Click on the terminal icon and select "show-output."
At this point, you should be able to view the content of the ...component.d.ts file in the terminal output.
Which @angular/* package(s) are the source of the bug?
compiler-cli, compiler
Is this a regression?
Yes
Description
When using
@Input({transform: transformFn})and the transformation function is exported from another file, the Angular compiler generates incorrect/mashed up types for the@Input. However, if the transformation function is in the same file as the@Input, everything works as expected. This bug only affects string literal types (I think).To illustrate the issue, here are screenshots of the incorrect and correct types:
Incorrect types:

Correct types:

Please provide a link to a minimal reproduction of the bug
https://codesandbox.io/p/github/uneknown/reproduce-angular-transform-issue/master
Please provide the exception or error you saw
Please provide the environment you discovered this bug in (run
ng version)Anything else?
Steps to Reproduce:
At this point, you should be able to view the content of the
...component.d.tsfile in the terminal output.