React: Upgrade react-docgen to 6.0.x and improve argTypes#23825
Conversation
| "types": ["node"], | ||
| "resolveJsonModule": true, | ||
| "strict": true | ||
| "skipLibCheck": true |
There was a problem hiding this comment.
what was this change necessary for?
There was a problem hiding this comment.
Good question. This PR is mostly changes from #22324 and I guess this is one of those.
There was a problem hiding this comment.
This was done, because the TS compiler options here are different than the settings in the react-docgen repo. This lead to one of the CI jobs to fail, because the it was validating react-docgen types with the different options (mostly strict stuff). I fixed a lot of it and enabled some more strict options in react-docgen, so maybe it works now.
Hey @danez did you have any luck with React.FC? Thank you so much for taking a look into it! <3 |
react-docgen to 6.0.x and improve union handlingreact-docgen to 6.0.x and improve data handling
react-docgen to 6.0.x and improve data handlingreact-docgen to 6.0.x and improve argTypes
react-docgen to 6.0.x and improve argTypesreact-docgen to 6.0.x and improve argTypes
|
@danez FYI we're going to evaluate https://www.npmjs.com/package/typescript-react-function-component-props-handler and will report back. If it works well, it could be a good candidate to incorporate in the default settings. cc @valentinpalkovic |
|
Nice. React.FC is already supported on the main branch of react-docgen but I noticed some other issues that i want to fix first, especially because i had to make a breaking change again. |
|
@shilman, @danez I took a quick look at the custom resolver , and it failed pretty quickly @danez Do you need some support? I would say I don't spend time fixing the third-party resolve, but instead, I would rather wait and/or support your work on the main branch. |
|
I went to try this out but I am getting an error when running storybook. Already had Did a clean install. When I run storybook I get this error: @storybook/cli v7.4.3 So I tried to specifically install the canary of @storybook/cli and it didn't help. I have reread the instructions above and I feel like I am missing something. Storybook runs fine with 7.1.0 but was hoping to test the updates for react-docgen. We have issues around pulling in descriptions for arg types when a component Type is extending another component's types. |
|
I released version 7.0 of react-docgen which supports |
|
cc @shilman ☝️ |
|
First, great work on this excellent product! I tried running v7.0 (by npm override) with sb v7.5 and am getting unexpected and strange errors. |

Extends #22324
What I did
NOTE: This only applies to VITE projects, not Webpack ones yet!!!
Extends #22324:
react-docgento 6.0.xFollowup:
Also improve argType generation:
unionsofliteralsintoenum, which generate proper controlsHow to test in your project
To test this out in a React Vite TS project, install the canary version listed at the top of this PR into a project by manually updating its
package.jsonto update all the@storybook/*packages from this monorepo:Once you've installed the packages, edit
.storybook/main.tsto contain:The behavior should be the same as before, but running
storybook devshould be dramatically faster than before.If you run into issues, please comment on this PR!
How to test in a development sandbox
.storybook/main.tsto contain:starbucks-size.tsinsrc/storiesdirectory:Button.tsxcomponent with a new prop:Checklist
Needs tests:
🦋 Canary release
This pull request has been released as version
0.0.0-pr-23825-sha-7875282b. Install it by pinning all your Storybook dependencies to that version.More information
0.0.0-pr-23825-sha-7875282bshilman/fix-react-docgen-enum7875282b1692700244)To request a new release of this pull request, mention the
@storybookjs/coreteam.core team members can create a new canary release here or locally with
gh workflow run --repo storybookjs/storybook canary-release-pr.yml --field pr=23825