You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
BUG: typeCheckHostBindings: true not infering type correctly for host directive output #62783
Which @angular/* package(s) are the source of the bug?
core
Is this a regression?
No
Description
When you enable typeCheckHostBindings in tsconfig compilation will fail for working code for code that works otherwise. When you attach directive with output using host directives to some component and at the same time you use host to bind to this output you will receive error about parameter type.
test.directive.ts
/** * Test directive */
@Directive({selector: '[test]',})exportclassTestDirective{publicout: OutputEmitterRef<number>=output<number>();}
As you can see you have output of type number and event listener with same parameter type, so you are trying to assign number to number, but you will receive error Argument of type 'Event' is not assignable to parameter of type 'number'.
Same error if the component has an output and a directive that sits on it is listening to the output event via host.
I have a tabs component with an tabChange output. Then i have a directive that listens to the tabChange outputs and does a specific action (in my case change the route queryParams).
Same error if the component has an output and a directive that sits on it is listening to the output event via host.
I have a tabs component with an tabChange output. Then i have a directive that listens to the tabChange outputs and does a specific action (in my case change the route queryParams).
Note that this will not be supported with #62965, as any such directives are non-local to the directive/component and can therefore not be included in its type-checking context.
Activity
scurk1415 commentedon Jul 25, 2025
Same error if the component has an output and a directive that sits on it is listening to the output event via
host.I have a tabs component with an
tabChangeoutput. Then i have a directive that listens to thetabChangeoutputs and does a specific action (in my case change the route queryParams).fix(compiler-cli): correctly type check host listeners to own outputs
fix(compiler-cli): correctly type check host listeners to own outputs
fix(compiler-cli): correctly type check host listeners to own outputs
fix(compiler-cli): correctly type check host listeners to own outputs
JoostK commentedon Aug 4, 2025
Note that this will not be supported with #62965, as any such directives are non-local to the directive/component and can therefore not be included in its type-checking context.
fix(compiler-cli): correctly type check host listeners to own outputs (…
fix(compiler-cli): correctly type check host listeners to own outputs (…
angular-automatic-lock-bot commentedon Sep 5, 2025
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.