Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

make DataProvider an interface

未关闭
#7,326 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

  • #7351 来自 @antdking —— 已关闭,未合并

评估

难度
5/5
预计耗时
一周以上
新手友好度
35/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
停滞
技术栈
react, typescript
领域
frontend

调研方向

定位 DataProvider 类型别名,并检查它在 hooks 以及 resource/model typings 中的使用情况。检查将其改为 interface 如何影响泛型传播和 injectable 类型定义,然后使用提议的 demo 验证行为;完成的标准是:无需显式的泛型 wrapper,resourceName 到 RaRecord 的关联就能在各个 hooks 中正常工作。

由索引模型根据 Issue 内容生成。

描述

Is your feature request related to a problem? Please describe.
Currently, to extend the DataProvider, we have to be very explicit about generics, and do a fair amount of hackery to expose Models/Resources everywhere.
The aim here is to build an abstraction around the pieces in react-admin, to make wiring up APIs/Models/Views a lot more seamless within editor environments (fully static with plain JS for users).

Describe the solution you'd like
Currently, DataProvider is a TypeAlias, which are not injectable.
By allowing us to inject the DataProvider, we can cause resourceName -> RaRecord associations to propagate to all the hooks (useGetList('cats') should automatically find my Cat Model).

For now, changing it from type to interface might be enough, however I'm unsure of the fallout. I'll spin up a PR with a Demo to verify how it all goes, and so you have something physical to see.

I suspect this will be beneficial for the no-code project, however I've yet to do a dive into what that is in detail.

Describe alternatives you've considered
Wrapping + explicit types == Code too noisy

Additional context
n/a

主要语言
TypeScript
星标
27k
派生
5.5k
平均合并
1 天 3 分钟
30 天内合并 PR
32

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

marmelab/react-admin 的其他 Issue

查看 marmelab/react-admin 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。