-
-
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
[Bug]: Storybook v8.0.0-alpha.16 unknown types #25909
Comments
@MariaTeo thank you for testing Storybook 8-alpha! I am not able to reproduce your issue in a fresh Next.js project. Could you share a reproduction of your issue with storybook.new? That will help us significantly in the debugging process. Thank you! |
hello @vanessayuenn thank you for your response. I have reproduced the issue here. Hope that helps |
I've put up another repro of this behavior here. // variants.ts
export const variants = {
sizes: {
small: 'text-sm',
medium: 'text-base',
large: 'text-lg',
},
}; // Button.tsx
type SizeOptions = keyof typeof variants['sizes'];
interface ButtonProps {
// ...
/**
* How large should the button be?
*/
size?: SizeOptions; In the description for
Storybook 7 handles this correctly:
I've experimented and it only says const sizes = {
small: 'text-sm',
medium: 'text-base',
large: 'text-lg',
};
export const variants = { sizes };
type SizeOptions = keyof typeof sizes;
This is also what you get if you put a union type directly in the prop: interface ButtonProps {
//...
intent?: 'secondary' | 'primary';
}
Again, Storybook 7 handles both of these cases correctly, listing the actual options instead of returning |
@HerbCaudill I've verified that setting |
@MariaTeo I think the PR attached closes your issue. Considering you're overriding argTypes manually, you might find that you'll sometimes need to manually specify the
And you can supply something more complex using |
This is happening in a nextjs14 project with typescript.
this is part of my package.json
My config seems to be fine. Types of props are not being defined in the storybook docs
To Reproduce
No response
System
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: