Using DataProvider in ReactAdmin, how to fix an errorr: the expected type comes from the return type of this signature

I’m following the tutorial to implement dataprovider in react-admin. Here is the link: https://marmelab.com/react-admin/Tutorial.html#connecting-to-a-real-api

Below is the sample implementation of tutorial

  create: (resource, params) =>
    httpClient(`${apiUrl}/${resource}`, {
        method: 'POST',
        body: JSON.stringify(params.data),
    }).then(({ json }) => ({
        data: { ...params.data, id: json.id },
    })),

But in typescript it raise an error the expected type comes from the return type of this signature.

How can I fix the error?

Leave a Comment