Skip to content

Output emitters are not properly supported in hybrid AngularJS application #60366

@Daess

Description

@Daess

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

upgrade

Is this a regression?

No

Description

Hello!

We have a big application implemented with AngularJS, which we are currently migrating to the latest Angular (19.2.2 at the moment of bug report creation). We have stumbled into the following error when trying to integrate downgraded component into AngularJS component: "TypeError: listenerFn is not a function at OutputEmitterRef.emit". I looked into the Angular source codes to find out the reason and saw the following: OutputEmitterRef.subscribe accepts a function as an argument (output_emitter_ref.ts:47) while upgrade assistant provides an object RxJS style (downgrade_component_adapter.ts:263). So I believe any case of usage of downgraded component with outputs in it will lead to this issue.

Please provide a link to a minimal reproduction of the bug

No response

Please provide the exception or error you saw

TypeError: listenerFn is not a function
    at OutputEmitterRef.emit (.angular/cache/19.2.2/jsengine/vite/deps/chunk-2NASP45P.js?v=ed0c9fb9:5735:11)
    at ... (proprietary code)
    at .angular/cache/19.2.2/jsengine/vite/deps/@angular_upgrade_static.js?v=a8bb2139:401:31
    at Scope.$digest (.angular/cache/19.2.2/jsengine/vite/deps/angular.js?v=a8bb2139:9796:29)
    at Object.next (.angular/cache/19.2.2/jsengine/vite/deps/@angular_upgrade_static.js?v=a8bb2139:1277:29)
    at ConsumerObserver2.next (.angular/cache/19.2.2/jsengine/vite/deps/chunk-GM2YTKEO.js?v=ed0c9fb9:583:25)
    at Subscriber2._next (.angular/cache/19.2.2/jsengine/vite/deps/chunk-GM2YTKEO.js?v=ed0c9fb9:553:22)
    at Subscriber2.next (.angular/cache/19.2.2/jsengine/vite/deps/chunk-GM2YTKEO.js?v=ed0c9fb9:526:12)

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

Angular CLI: 19.2.2
Node: 20.17.0
Package Manager: npm 10.8.2
OS: darwin arm64

Angular: 19.2.2
... animations, cli, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router, upgrade

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1902.2
@angular-devkit/build-angular   19.2.2
@angular-devkit/core            19.2.2
@angular-devkit/schematics      19.2.2
@schematics/angular             19.2.2
rxjs                            7.8.1
typescript                      5.5.4
zone.js                         0.15.0

Anything else?

No response

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions