Type error in react query useMutation hook
useCustoumMatation.ts
import apiClient from "@/services/api/api-client";
import { useMutation } from "@tanstack/react-query";
type Shop =
{ shopCode: string;
shopName: string;
mobileNo: string;
address: string;
};
const createBook = async (bookData: Shop) => {
const { data } = await apiClient.post("/books", bookData);
return data;
};
export const useCreateBook = () => {
return useMutation<Shop, Error, Shop, unknown>(createBook,
{ onSuccess: () => {
// invalidate the query cache for 'shop' }, }); };
ShopList.ts
const {mutate} = useCustoumMatation() const onSubmit = (data:Shop) => {
mutate(data)
}
How can i properly pass the type for that error. I am currently using react query v5.28.14.