Skip to content

refactor(devtools): type message bus callbacks - #70823

Open
splincode wants to merge 1 commit into
angular:mainfrom
splincode:type-devtools-message-callbacks
Open

splincode wants to merge 1 commit into
angular:mainfrom
splincode:type-devtools-message-callbacks

Conversation

@splincode

Copy link
Copy Markdown
Contributor

PR Checklist

Please check if your PR fulfills the following requirements:

  • The commit message follows the Angular commit guidelines
  • Tests for the changes have been run
  • No documentation changes are needed

PR Type

  • Bugfix
  • Feature
  • Code style update
  • Refactoring (no functional changes, no API changes)
  • Build related changes
  • Documentation content changes
  • Other

What is the current behavior?

The DevTools message bus implementations use any casts when invoking event callbacks because the relationship between a callback and its argument tuple is not preserved at the invocation site.

PriorityAwareMessageBus also uses any for forwarded callback arguments.

What is the new behavior?

MessageBus now provides a typed invokeCallback helper that preserves the callback parameter tuple through Parameters<F>.

The DevTools message bus implementations use this helper instead of casting callbacks to any.

PriorityAwareMessageBus also types forwarded arguments as Parameters<Events[E]>, and ChromeMessageBus keeps the message topic tied to the same generic event key when invoking a callback.

This removes the unsafe callback casts while preserving the existing runtime behavior and public API.

Does this PR introduce a breaking change?

  • Yes
  • No

@pullapprove
pullapprove Bot requested a review from csmick September 19, 2026 15:13
@ngbot ngbot Bot added this to the Backlog milestone Sep 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant