-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
React: Upgrade react-docgen
to 6.0.x and improve argTypes
#23825
Conversation
@@ -4,7 +4,7 @@ | |||
"rootDir": "./src", | |||
"types": ["node"], | |||
"resolveJsonModule": true, | |||
"strict": true | |||
"skipLibCheck": true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what was this change necessary for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good question. This PR is mostly changes from #22324 and I guess this is one of those.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A @ndelangen special, here: a26c431
(#22324)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That seems wrong, indeed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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-docgen
to 6.0.xFollowup:
Also improve argType generation:
unions
ofliterals
intoenum
, 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.json
to update all the@storybook/*
packages from this monorepo:Once you've installed the packages, edit
.storybook/main.ts
to contain:The behavior should be the same as before, but running
storybook dev
should be dramatically faster than before.If you run into issues, please comment on this PR!
How to test in a development sandbox
.storybook/main.ts
to contain:starbucks-size.ts
insrc/stories
directory:Button.tsx
component 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-7875282b
shilman/fix-react-docgen-enum
7875282b
1692700244
)To request a new release of this pull request, mention the
@storybookjs/core
team.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