-
Notifications
You must be signed in to change notification settings - Fork 32
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]: Typescript - Add typings to both <Template> and <Story> args #68
Comments
I'm not sure this is solveable within svelte-csf; svelte doesn't have support for typescript outside of the As a workaround, would this work? <script lang="ts">
import Choice from './Choice.svelte';
import choiceProps from './choiceProps.ts';
const choiceArgs = {
choiceText: 'Choice 1',
value: 'choice-1',
name: 'choice-1'
} satisfies choiceProps;
</script>
<Template let:args id="ChoiceTemplate">
// Ideally I would have the option to set that args has the choiceProps type
<Choice {...args} />
</Template>
<Story
id="ChoiceStory"
name="Choice"
template="ChoiceTemplate"
args={choiceArgs}
/> |
I'm not sure what this is really requesting to change in |
@benmccann in case it's not on your roadmap, svelte 5 adds typescript support in the svelte markup sveltejs/svelte#9482, so I believe this should be possible now (and greatly appreciated! 🙏) Not sure if it makes more sense to re-open here or spin up a new issue for it. It would require svelte 5, making it a potentially breaking change for svelte 4 users. |
Describe the bug
Whenever I use both the
<Template>
and<Story>
components, it would be great to be able to set the expected type oflet:args
.Ex:
The text was updated successfully, but these errors were encountered: