How to infer args from typescript types that use generics or utility types? #31591
Unanswered
jfarris587
asked this question in
Help
Replies: 1 comment
-
Admittedly, resolved this not too long after posting. Apparently, out of the box, this will not work with npx create storybook. Add the following to "typescript": {
"reactDocgen": "react-docgen-typescript",
}, |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
When using Storybook Docs and Typescript, do we have to manually add the args and options to the Story if the component is utilizing generics or utility types?
Below is
main.ts
Consider the story for a button:
Take the below example, Storybook automatically can infer the
variant
args and they are available as controls with radio options:Take the below example, using class-variance-authority, we have the
VariantProps
utility to infer"primary" | "secondary"
. However Storybook now no longer brings in any args automatically:Additional information
No response
Create a reproduction
No response
Beta Was this translation helpful? Give feedback.
All reactions