Replies: 2 comments 2 replies
-
I don't think this would work. As you have pointed out with your second link, there is an overloaded function that has the config as the last parameter. You can only have varargs at the end of a parameter list, so, to take your example:
wouldn't really work I think. TypeScript also yields the following error if I try to do that in a playground
|
Beta Was this translation helpful? Give feedback.
2 replies
-
will this be fixed in v3? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I wanted to do a PR but decided to discuss before that.
I think we have a mistake with types of mutation function here:
https://github.com/tannerlinsley/react-query/blob/master/src/core/types.ts#L264
https://github.com/tannerlinsley/react-query/blob/master/src/core/types.ts#L273
I suppose it should be
...variables: TVariables
instead of justvariables: TVariable
because now if you have several arguments in mutation function there is no way to type them all in a clean way.E.g. I want to provide types for two arguments
TVariables = [string, number]
, but now if I do so it will lead to a situation where I have to call mutation function in that waymutation(['someStr', 42])
and I want it to bemutation('someStr', 42)
Beta Was this translation helpful? Give feedback.
All reactions