-
-
Notifications
You must be signed in to change notification settings - Fork 9.5k
[Bug]: react-docgen
not correctly populating Description column if props are Readonly
#26593
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I also encounter the problem when i use
There aren't description content in controls tab and i see So i have to assign the type to
|
I also hit this issue while using This is related to #26496 Following examples are for: export type SurfaceProps = {
children: ReactNode;
/** Background of the surface box */
background?: (typeof SurfaceBackgrounds)[number];
/** Corner rounding of the surface box */
radius?: (typeof SurfaceRadii)[number];
/** Size of the box shadow. Takes and integer, Bigger value, bigger size of the shadow */
elevation?: number;
/** Show border around the surface box */
hasBorder?: boolean;
/**
* Switch color scheme for light or dark backgrounds
*
* @deprecated Replaced with design tokens for using dark mode add .dark classname
* to Surface or its parent
*/
mode?: (typeof SurfaceMode)[number];
} & ComponentPropsWithoutRef<'div'>;
const Surface = forwardRef<HTMLDivElement, SurfaceProps>(( props, ref ) => {
...
); V7 or V8 with
|
Is there any progress on this? |
This is an issue in Please help fix the issue there or, if you can't wait for the fix, please use https://storybook.js.org/docs/api/main-config/main-config-typescript |
I run into this problem even with |
@Charismara Is that issue related to Readonly properties or is it about including properties from |
I suppose it is mainly about including properties from the node_modules but a bunch of those props are string literals |
Any progress on this? |
Up |
1 similar comment
Up |
It looks like pnpm is causing that issue for me. I tested it with Bun and npm and both times all props showed up. |
Describe the bug
After the latest major update, which brings the new autodocs package
react-docgen
, the doc table of all of my stories is missing pieces of information. Before it was populating the Description column with the JSDocs of component's props' interface:Resulted in:
After the update it looks like this:
As you can see the text I wrote in the JSDocs is missing and the type of the two props with a default is not correctly inferred.
While trying to create a repro I discovered that the issue lies in the use of utility type
Readonly<T>
. You can open the repro and see docs for Button are badly generated. RemoveReadonly
and restart sb, you'll see they'll be correctly generated.As a workaround I switched to the old
react-docgen-typescript
which is handlingReadonly
correctly.To Reproduce
https://stackblitz.com/edit/github-inlxfv?file=src%2Fstories%2FButton.tsx
System
Additional context
No response
The text was updated successfully, but these errors were encountered: