-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Type error when trying to use spread syntax to pass matchers to isAnyOf
or isAllOf
#2209
Comments
Seems worth tweaking, although I don't have time to look into this myself atm. |
It'd still be nice to get this tweaked, but it's low priority. Dropping it out of the 1.9 milestone. If anyone wants to tackle it, please let us know! |
I'll repost the gist of my opinion here from Twitter, just in case: so, the problem is, current type signature intentionally requires one element, however So the question is really, whether |
That makes sense. My vote is to make |
Merged, will be out in 1.9.2 shortly. |
I have a big list of thunks that I want to observe in order to power loading indicators in a pseudo-global way and accomplishing this with matchers.
Instead of writing this which is tedious and error-prone:
I would prefer to write this:
But I get the following type error when I try that:
Which seems to be happening because the type definition is:
There is a rest argument, but the first argument is a matcher. The workaround is to provide the first argument as normal to satisfy the condition and use the rest syntax for the others. This is a bit more verbose and not intuitive. My guess is that the first argument is defined as such so that it isn't possible to try and call isAnyOf without any arguments but maybe there is a way to have our cake and eat it as well.
Workaround:
The text was updated successfully, but these errors were encountered: