-
-
Notifications
You must be signed in to change notification settings - Fork 9.5k
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
[Feature Request] Support ArgTypes inference from TS prop types in Svelte #28232
Comments
This is unrelated to TypeScript types have never been supported, so I consider this a feature request and rather than a bug. There isn't proper tooling in the Svelte community to get prop types from a TS-typed Svelte-component, so we're blocked on the Svelte team or community providing such a tool. Eg. Vue has |
Thanks for providing more context around this and putting it in the right place.
Could we not use the Svelte ComponentProps for the prop types? |
They are only TypeScript-level types, they can't be used to generate anything at runtime, as types are stripped away. Years of experience have taught us that this specific problem is best solved by the specific framework's communities, as attempting to solve it within Storybook is biting of more than we can chew. Here are a few examples:
We're hoping that eventually the Svelte team will provide an API like this, but currently they have their hands full with the release of v5, which makes sense. The Svelte Language Server must do this computation internally to work, however its not exposed as an API, and Storybook's architecture isn't built to be able to interact with a language server. |
@JReinhold This seems to be working with |
Describe the bug
The Typescript types in a Svelte component don't come through to the props table in Storybook.
Steps to reproduce the behaviour
MyComponent.svelte
MyComponent.stories.svelte
Storybook Properties table:
any
"My title"
string
Default value
Another title
string
titled
any
. Unlesslang=ts
removedstring
The last one
Note: with the
title
showing typeany
in Storybook, the control is an Object so the UX is poor.Expected behaviour
The expected behaviour would be that the
title
in the Storybook Properties table would have the correct type and associated control.Environment
@storybook/addon-svelte-csf
: "4.1.3"The text was updated successfully, but these errors were encountered: