Open TheDutchCoder opened 2 years ago
The only workaround for this, is to supply the variables when calling the mutation manually, e.g.:
const { mutate } = useMutation<Logout, LogoutVariables>(LOGOUT)
const doThing = () => mutate({
input: {
id: 'test',
foo: 'bar', // throws TS error
},
})
The following also seems like a TS bug:
const variables = ref({ // same issue for `reactive` instead of `ref`
input: {
id: 'test',
},
})
const {
mutate: logout,
onError: onErrorLogout,
} = useMutation<Logout, LogoutVariables>(LOGOUT, variables) // throws a TS error, see below
// Argument of type 'Ref<{ input: { id: string; }; }>' is not assignable to parameter of type 'OptionsParameter<Logout, LogoutVariables> | undefined'.
Describe the bug When using TypeScript, you lose type safety when using a function to supply the variables:
To Reproduce Steps to reproduce the behavior:
Expected behavior Type safety to work when supplying a (mandatory) function
Versions vue: 3.2.20 @vue/apollo-composable: 4.0.0-alpha.16 @apollo/client: 3.5.10