-
-
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
Docs addon fails to render props table when source code uses default export types #9556
Comments
My understanding is that this has been an issue for a while and is due to the limitations of The limitations are called out at https://www.npmjs.com/package/react-docgen-typescript-loader#limitations and https://github.com/styleguidist/react-docgen-typescript#example. I would love for this to be addressed too if possible. |
@jeffu92 are you familiar with |
@shilman Not particularly, unfortunately. I just ran into this issue myself recently, so figured I'd share what I found. |
@jeffu92 FWIW the link you shared is discussing the need for your source code to use named exports. I don’t think they realize the limitation of using default exports from dependencies as external types. |
Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks! |
still a bug |
Repro: 92f8c43 |
Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks! |
Go away |
@kylemh can you try the recommended 6.0 setup (should work in 5.3 too) and based on the repro linked above I expect the problem to be fixed: https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#react-prop-tables-with-typescript |
I'll give it a whirl tomorrow! |
I gave this a try in other projects, but wasn't successful - although I'm a bit sleep-deprived. Theoretically, I should be able to take this minimal TSDX + React + Storybook repo, and do:
And be good to go, right? |
Seems to still be an issue, but it sounds like there's a PR for the fix here: Please ignore the fact that the example uses React.FC. It's still an issue outside of this. |
Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks! |
reactjs/react-docgen#352 is still open 🤷 |
Yeah @kylemh I still don't have a good strategy to deal with this. Fixing bugs in |
Since the solution is outside the scope of the project, please feel free to close the issue! |
Any progress in this issue? @shilman |
Reopening this. Although this is a limitation of another library, we should track it and figure out a fix one way or another. |
We’re cleaning house! Storybook has changed a lot since this issue was created and we don’t know if it’s still valid. Please open a new issue referencing this one if:
|
Describe the bug
In a TypeScript React (non-CRA) setup with the Docs addon and the
react-docgen-typescript-loader
, the props table will not work if you use the React default export's properties for type definitions.(Please ignore the fact that the example uses React.FC. It's still an issue outside of this.)
In other words...
WORKS:
DOES NOT WORK:
For what it's worth, if you use a named export type for FC, but keep doing
React.ButtonHTMLAttributes
, then you'll only seeisDisabled
defined in the table.To Reproduce
Steps to reproduce the behavior:
npx -p @storybook/cli sb init --type react
yarn add -D ts-loader @storybook/addon-docs @storybook/addon-info react-docgen-typescript-loader react-is babel-loader
.storybook/main.js
:and create some stories to compare!
Expected behavior
I should be able to create stories regardless of how I use types from dependencies.
System:
The text was updated successfully, but these errors were encountered: