-
-
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
Webpack5: Typescript argTypes not auto-generated #14118
Comments
Do you have a repro repo you can share? |
Thanks for your reply, I have set up a sample repro at https://github.com/Titou325/storybook-14118 Do not hesitate to reach out if I can be of any help, Have a nice day |
Thanks so much for the repro! I took a look. Some initial notes:
I ran Will continue digging. |
Hi! Hope you are doing well, I have been investigating a bit on my end, and the problem seems to occur before the typescript files are being handed to I have tried to initialize a very simple Storybook w/ Webpack 5 repository and can't get anything to work, here is the link to the repro: https://github.com/Titou325/storybook-14118-2 I have run a very simple I would consider this to be a blocker for the Webpack 5 release given that the docs still state that Typescript should be supported out of the box. I will try to see if I can narrow it further down, but I am far past my expertise domain here. Again, let me know if there is anything that I can do to help you in this regard. Have a nice weekend |
Re: your new repo, there is no I'm still stuck on your first repo, will try to spend more time on that today. Thanks for setting up these repros and for your patience! |
Hello! Thanks for your reply. I definitely forgot about the Thanks again, it is a pleasure to be of any help. Have a nice day! |
We're also experiencing this issue with the following versions in a React TypeScript project (we also tried
This is resulting in a runtime error for some stories: type: {
control: 'radio',
}, Previously, my understanding is that
Object.entries(undefined)
// Uncaught TypeError: Cannot convert undefined or null to object I was able to repro by copying the Running
However, running on webpack 4 produces:
This specific error ( And this implies I'm not sure what the The only short-term fix we are aware of is to explicitly comment out If helpful, I can create a repro repo, but I believe converting Let me know if there are any more details that would be helpful in debugging 👍 |
@skovy thanks for the debugging. i'm able to repro on From the webpack docs on
|
@hipstersmoothie I took a look at this with @ndelangen and it looks like We looked at the if (module.built === false) {
debugExclude(`Ignoring un-built module: ${module.userRequest}`);
return;
} After that hack, the
I'm still trying to decode this, but it seems like we can add these Dependencies in the |
@shilman shouldn't this issue get the label |
Same here. using webpack 5 in project but webpack 4 in storybook |
Also facing this issue... I guess no workaround is available except creating argTypes manually? |
@danantal we should have a fix for |
Crikey!! I just released https://github.com/storybookjs/storybook/releases/tag/v6.3.0-alpha.35 containing PR #14991 that references this issue. Upgrade today to the
Closing this issue. Please re-open if you think there's still more to do. |
ZOMG!! I just released https://github.com/storybookjs/storybook/releases/tag/v6.3.0-alpha.36 containing PR #14991 that references this issue. Upgrade today to the
|
I've tested newest version (6.3.0-beta.1) and the issue is still there. I've upgraded with the command |
I’m with @petr001. Issue still exists. |
@petr001 @mrtnbroder Can you please create a reproduction by running |
The command is not working for me. But my steps to reproduce:
Installed storybook version was 6.3.4. I've tried also 6.4.0-alpha.18 (with the same result). Any hint why it's not working? |
I've found it - it's because of this bug: styleguidist/react-docgen-typescript#323 |
I also had this issue using 6.4.9, thanks to @petr001 managed to get the following workaround which is to change the Component export from default exports to named export |
@ShuPink this addressed the auto-generation for me as well. Thanks for posting this! I'd like to avoid exporting our components as named exports. Does anyone have an insight around why default exports might now be generating controls? |
|
Still present in |
@oreqizer Hey, did you manage to find a solution? except from named export |
Nope |
Any workaround on this guys? |
I am still having this issue. Does anyone fixed it? |
just by also exporting a named component, and using that in stories // Export named for Storybook
// 👉 https://github.com/storybookjs/storybook/issues/14118
export function Component () {
// ...
}
export default Component; then in your story: import { Component } from "components/Component"; |
Does this issue affect non-TS repos as well? I'm seeing basically the same behavior in a non-TS codebase. |
@AndyOGo Got a reproduction you can share? |
In my case, the problem was that the component being tested was different from the file name. Once I changed the name, Storybook was able to detect all types. |
Describe the bug
It seems that typescript typings for react components do not get picked up correctly when using Storybook 6.2 beta
To Reproduce
See attached snippets
Expected behavior
Storybook should pick up the typescript typings (enums, ...) correctly and not show
No inputs found for this component.
Screenshots
Code snippets
Sample component
External typings
Storybook main config
System
Additional context
We have in the same project a Gatsby 3 instance using the components that are shown in Storybook, hence our switch to Sb^6.2 to switch the whole codebase to Webpack 5.
It seems that some typings are getting picked up, but not correctly as shown in the screenshot below where
cardRatio
is an enum and shown as a text field.Thanks a lot for your help & time
┆Issue is synchronized with this Asana task by Unito
The text was updated successfully, but these errors were encountered: