-
Notifications
You must be signed in to change notification settings - Fork 27k
Event listener type checking fixes #60561
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Moves the logic for parsing event names out into methods on the `BindingParser` so we don't have to duplicate it. Also updates the types to more accurately represent the runtime value.
Currently the TCB generation code doesn't handle targeted events (e.g. `(document:click)`) which ends up binding to the current element and can have type inference implications. These changes take the event's `target` into account.
Fixes that we weren't accounting for targeted events when creating the AST for `@HostListener`-decorated members.
| constructor( | ||
| name: string, | ||
| targetOrPhase: string, | ||
| targetOrPhase: string | null, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OOC: was the value before just empty if there isn't a target or phase?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was a null that was non-null-asserted to any.
|
This PR was merged into the repository by commit 1e6faad. The changes were merged into the following branches: main |
Currently the TCB generation code doesn't handle targeted events (e.g. `(document:click)`) which ends up binding to the current element and can have type inference implications. These changes take the event's `target` into account. PR Close #60561
Fixes that we weren't accounting for targeted events when creating the AST for `@HostListener`-decorated members. PR Close #60561
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Fixes the following issues with how we type check event listeners:
refactor(compiler): allow name parsing logic to be reused
Moves the logic for parsing event names out into methods on the
BindingParserso we don't have to duplicate it. Also updates the types to more accurately represent the runtime value.fix(compiler-cli): set correct target when type checking events
Currently the TCB generation code doesn't handle targeted events (e.g.
(document:click)) which ends up binding to the current element and can have type inference implications. These changes take the event'stargetinto account.fix(compiler-cli): correctly parse event name in HostListener
Fixes that we weren't accounting for targeted events when creating the AST for
@HostListener-decorated members.