panter / ra-data-prisma

Packages to connect react-admin with prisma version 2
MIT License
85 stars 28 forks source link

Incorrect return type on `useDataProvider` #95

Closed sMteX closed 3 years ago

sMteX commented 3 years ago

If I'm not mistaken, buildDataProvider returns the old version/interface of data provider - function (type, resource, params) => Promise<any> (https://github.com/panter/ra-data-prisma/blob/master/packages/dataprovider/src/buildDataProvider.ts#L36), which corresponds to React Admin's LegacyDataProvider (https://github.com/marmelab/react-admin/blob/master/packages/ra-core/src/types.ts#L303)

However, the return type of useDataProvider says DataProvider which has a different signature and cannot be casted (useDataProvider() as LegacyDataProvider).

Workaround is something like (useDataProvider() as unknown) as LegacyDataProvider which isn't very nice.

macrozone commented 3 years ago

@sMteX you might be right, so we should probably just set its type as LegacyDataProvider

macrozone commented 3 years ago

:tada: This issue has been resolved in version @ra-data-prisma/dataprovider-v6.6.2 :tada:

The release is available on:

Your semantic-release bot :package::rocket: