react-admin icon indicating copy to clipboard operation
react-admin copied to clipboard

Fix JS docs (@typedef)

Open erwanMarmelab opened this issue 1 year ago • 2 comments

We have many components that have @typedef and @prop in their documentation.

They should only use param

Example

  * @typedef Props
  * @property {Object} record: The current resource record

To:

  * @param {Object} props
  * @param {Object} props.record The current resource record

erwanMarmelab avatar Apr 02 '24 09:04 erwanMarmelab

I don't agree. The second definition means the function has 2 params, which is wrong. What needs to be done is to set the param to the defined type, e.g.

  * @typedef Props
  * @property {Object} record: The current resource record
  *
  * @param {Props} 

fzaninotto avatar Apr 02 '24 11:04 fzaninotto

What we actually need to do is to move the @param JSDoc annotations to the TypeScript Prop types definitions, as in

https://github.com/marmelab/react-admin/blob/6b78433893e0f7fc48db69c63a529b3c2e3d5c60/packages/ra-core/src/controller/list/useListController.ts#L181-L392

fzaninotto avatar Apr 18 '24 15:04 fzaninotto

Closing as we need to go in another direction

fzaninotto avatar May 13 '24 11:05 fzaninotto