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

Typescript - is an event handler always required to return an EventCallbackInterface? #1851

Closed
tvsmk opened this issue May 13, 2021 · 1 comment

Comments

@tvsmk
Copy link
Contributor

tvsmk commented May 13, 2021

Bugs and Questions

The Problem

When using Typescript and assigning event handler that does not return anything, the "No overload matches this call" error is thrown.

Reproduction

Sandbox created here: https://codesandbox.io/s/long-snow-m6vnz?file=/index.tsx

Description

When using Typescript and assigning an onClick event handler that does not return anything, the "No overload matches this call" error is thrown. The only required prop on the EventCallbackInterface is the mutation prop, however I do not want to mutate anything, just do something arbitrary such as navigate to a different page. When it runs, the event handler is called correctly so I believe this is maybe a type definition issue. Is there a workaround for this? Thanks

@boygirl
Copy link
Contributor

boygirl commented May 13, 2021

You're right. I think this is a type definition issue. The solution will be altering the type def in the library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants