-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Closed
Description
Describe the bug
useMutation changes the return type of provided promise by adding undefined to it.
To Reproduce
const apiCall = () => new Promise<string>(resolve => resolve());
const useExample = async () => {
const [mutateCall] = useMutation(apiCall);
const response = await apiCall(); // string
const mutateR = await mutateCall(); // string | undefined
};Wrapping a function in useMutation adds a undefined to it's returned promise
Expected behavior
The provided function's return type should not be changed.
Desktop (please complete the following information):
- Version: 23
Additional context
I don't see any reason why this would be required. Together with #1077 this is making migration to this library pretty unnecessarily painful by imposing this opinionated types.
romeerez and Barakat
Metadata
Metadata
Assignees
Labels
No labels