marmelab / marmelab/react-admin
Flattened types
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 26.9k
- Forks
- 5.5k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 19
Description
Especially for beginners, it can be quite hard to understand the types of react-admin due to its highly reusable type structure.
For example in the DataProvider type definition we have for the getList method:
getList: <RecordType extends RaRecord = any>(resource: ResourceType, params: GetListParams & QueryFunctionContext) => Promise<GetListResult<RecordType>>
However, it would be much more helpful to resolve the types directly. Like GetListParams & QueryFunctionContext could be resolved via some VS Code extension (https://marketplace.visualstudio.com/items?itemName=MylesMurphy.prettify-ts):
However, it's IDE-dependent and beginners probably do not know this.
What about using something like simplify from type-fest so it's directly in the codebase?
https://github.com/sindresorhus/type-fest/blob/main/source/simplify.d.ts
Has this ever been considered?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the DataProvider type definition and its getList signature, then review the linked type-fest Simplify definition and the VS Code extension example. Determine whether flattened types should be adopted and which type declarations are in scope; done requires an agreed implementation direction and validation of the resulting developer experience.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- developer-experience, frontend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100