angular / angular

Deliver web apps with confidence 🚀
https://angular.dev
MIT License
96.21k stars 25.48k forks source link

Signal output migration wrongly updates subject.next in templates #58630

Open cexbrayat opened 19 hours ago

cexbrayat commented 19 hours ago

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

core

Is this a regression?

Yes

Description

A template with the following HTML:

<button (click)="someSubject.next()">Click</button>

is migrated to:

<button (click)="someSubject.emit()">Click</button>

even if someSubject is a Subject and not an EventEmitter

The same issue exists in host listeners.

To repro, in the following Stackblitz, run:

ng g @angular/core:signals --migrations=outputs --path=./ --no-best-effort-mode

Please provide a link to a minimal reproduction of the bug

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

Please provide the exception or error you saw

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

Angular CLI: 19.0.0-rc.1
Node: 20.13.1
Package Manager: npm 9.7.1
OS: darwin arm64

Angular: 19.0.0-rc.1
... animations, cli, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1900.0-rc.1
@angular-devkit/build-angular   19.0.0-rc.1
@angular-devkit/core            19.0.0-rc.1
@angular-devkit/schematics      19.0.0-rc.1
@schematics/angular             19.0.0-rc.1
rxjs                            7.8.1
typescript                      5.6.3
zone.js                         0.15.0

Anything else?

No response

cexbrayat commented 19 hours ago

@pkozlowski-opensource I opened a PR with a potential fix in #58631