Skip to content

Conversation

@marcoroth
Copy link
Member

@marcoroth marcoroth commented Jan 24, 2023

This pull request explicitly types the options of the Controller.dispatch() method, so that the types don't need to be inferred.

In the case of #642 the type for the target option was just inferred from this.element, which lead to the issue that you weren't able to dispatch the event on any other target element unless it's type matched the defined type in the generic of the controller.

Resolves #642

@marcoroth marcoroth force-pushed the explicitly-type-dispatch-method branch from e95a7a0 to c870cee Compare January 24, 2023 02:58
@lb-
Copy link
Contributor

lb- commented Jan 24, 2023

Wow thanks @marcoroth super fast. Also, I did not know about Partial - really appreciate it @seanpdoyle

@marcoroth marcoroth merged commit d8c0910 into hotwired:main Jan 24, 2023
@marcoroth marcoroth deleted the explicitly-type-dispatch-method branch January 24, 2023 14:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Allow dispatch target type to not be the same as the controller element type

3 participants