Skip to content
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

Explicitly type options of Controller.dispatch() method #643

Merged
merged 1 commit into from
Jan 24, 2023

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

src/core/controller.ts Outdated Show resolved Hide resolved
@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