-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Extract StorybookArgs type to separate file and use it in other stories too #3761
Conversation
* This has been reported before: https://github.com/storybookjs/storybook/issues/11916 | ||
* If the official types get updated then we can remove this whole file | ||
* and import directly Args from '@storybook/react' |
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.
Just wondering: Would you like to do a PR in storybook to export those types?
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.
Yeah I'll look into that. I am afraid there's some roadblock - why else would the storybook people add the type in the docs but not in the code? But it's worth a try at least.
/* | ||
* This is the type as defined here: https://storybook.js.org/docs/react/api/arg-types#argtypes | ||
* The actual library exports only `interface Args { [name: string]: any; }`. | ||
* The "any" does not allow your editor to show autocomplete or documentation. |
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.
❤️ Love this. Thank you.
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.
Thank you a lot, this is great! Certainly makes all our life easier.
Thanks for the review @nikolasrieble. I wonder what's the usual workflow? I don't think I have merge permissions myself. Are we waiting for two approvers? |
Generally @nikolasrieble or myself will review and merge, sometimes waiting for more reviews depending on the size/implications of a change. Eventually I hope to have more maintainers will merge permissions |
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.
Very nice, thanks for doing this
followup from #3759 (comment)
Adding the type helps to find out what the properties are and what shape is expected.
Storybook website has it documented, and provides typescript types, but for some reason that type is not exported in code.
Description
Add type to storybooks
Related Issue
#3759
Motivation and Context
Helps to write storybooks.
How Has This Been Tested?
lint, ts
Screenshots (if appropriate):
Types of changes
Checklist: