Skip to content

feat(core): support generic parameter for custom data provider types …#7469

Open
arunkumarmeda27 wants to merge 1 commit into
refinedev:mainfrom
arunkumarmeda27:feat/use-dataprovider-generic-types
Open

feat(core): support generic parameter for custom data provider types …#7469
arunkumarmeda27 wants to merge 1 commit into
refinedev:mainfrom
arunkumarmeda27:feat/use-dataprovider-generic-types

Conversation

@arunkumarmeda27

Copy link
Copy Markdown

PR Checklist

Please check if your PR fulfills the following requirements:

Bugs / Features

What is the current behavior?

The useDataProvider hook returns data providers typed as the generic DataProvider type. There is no way to provide or use custom data provider types, forcing developers to manually cast types in their components to access custom methods or properties.

What is the new behavior?

Added support for a generic type parameter TDataProvider on the useDataProvider hook, which defaults to the standard DataProvider:
export const useDataProvider = <TDataProvider extends DataProvider = DataProvider>(): ...
This allows developers to specify their custom provider type (e.g. useDataProvider<CustomDataProvider>()), ensuring that the returned provider is fully typed without any type casting.

fixes #7445

@changeset-bot

changeset-bot Bot commented Jun 25, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 41e9495

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@refinedev/core Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEAT] useDataProvider hook should return the providers with their assigned types

1 participant