Closed benmccann closed 1 year ago
Yeah so the issue is that we detect TS Vs JS by seeing if typescript is a dependency of the project, but in SvelteKit that is always the case, presumably because it is used to check JSDocs. The detection determines if the default stories are written in TS or JS
So there are two possible fixes here:
I'm okay with 2, but I really don't want to remove TS files from our sandbox/ci templates, as it's a good way for us to catch any Storybook+SvelteKit+TypeScript regressions. So I'm hoping we can remove it from the CLI init, but keep them for sandboxes, where we control the SvelteKit setup anyway.
We use tsconfig.json
for TypeScript projects and jsconfig.json
for JS projects. Maybe you could just use the JS version of the story when jsconfig.json
is found?
Whoopee!! I just released https://github.com/storybookjs/storybook/releases/tag/v7.0.0-beta.44 containing PR #20944 that references this issue. Upgrade today to the @next
NPM tag to try it out!
npx sb@next upgrade --prerelease
Describe the bug
npx sb@next init
always generatessrc/stories/Button.svelte
as a TypeScript component. This won't work for projects that don't have TypeScript setupTo Reproduce
System
Additional context
I believe the SvelteKit wizard runs TypeScript files through the TypeScript compiler and outputs JavaScript versions of those files for JS projects, which may be an option to consider if you don't want to maintain two versions of the files. It might not be worth the setup if this is the only file you need both a JS and TS version of though