-
Notifications
You must be signed in to change notification settings - Fork 28
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
Bug: can't create an action without payload. 'ActionCreator<void>' is not assignable to '() => void' #81
Comments
I think it can be fixed like this:
|
See #82 |
In addition, we don't want payload to be present:
|
The issue is that you can't use void as a parameter type in generic:
There's no way to verify whether parameter value is void or not. The only place where void is allowed is the return value. So using void as a generic type to signify that a parameter can be omitted is wrong.
|
So it means the default value should be changed to something else that can be type guarded:
Should be changed to
|
Here's how similar issue fixed in redux-toolkit:
|
Oh, this looks even better:
|
Here's a rough example:
Here's an error:
To fix it, I have to change this:
To this:
Which is stupid.
The text was updated successfully, but these errors were encountered: