react.dev
react.dev copied to clipboard
Adding description to types
Can we add types description for React types, that can be supported for docs generators?
For example we use next inheritance:
import React, { ButtonHTMLAttributes, FC } from 'react'
export interface ActionIconProps
extends Pick<
ButtonHTMLAttributes<HTMLButtonElement>,
| 'title'
| 'tabIndex'
| 'className'
| 'style'
| 'aria-label'
| 'aria-haspopup'
| 'aria-expanded'
| 'onClick'
| 'onKeyDown'
| 'onMouseDown'
| 'onFocus'
| 'onBlur'
| 'disabled'
> {
/** My custom property */
myProp: string
}
and in doc system like Storybook it generated without description.
What do you think @eps1lon
We do have it in some places not every case. I'm all for adding more JSDOC to the React types.
I'm currently more occupied with cleaning up a lot of old code from the types. When I see low-hanging fruit, I definitely add docs.
In the meantime you could always add docs to the types where you think it would be helpful: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/react/index.d.ts
PS: I'm unassigning myself mainly so that people don't think they can't contribute to this issue. It's really a bigger effort that can be done by multiple people.