You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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>>
I agree that our reusable types produce complex IDE hints. I'm +1 for making these hints more user friendly. I'm marking this as an enhancement.
I didn't know about the Symplify type. It may be a good idea, but we must make sure that:
it keeps the JSDoc for types
it doesn't mess up with unions (see ListControllerResult)
Finally, not all type hints are usable in an IDE. For instance, when you start typing n HTML element, IDEs suggest a list of 250 possible attributes. We don't want to spend time refining that kind of list.
My suggestion: open a PR implementing this type of simplification on a small subset of hooks and components, so that we can judge the result.
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 thegetList
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
fromtype-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?
The text was updated successfully, but these errors were encountered: