-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Cannot import TS types from Svelte components in .svelte.ts files
#14884
Comments
This is probably some sort of compiler issue, since typescript AST nodes are removed during compilation, and Svelte IDE tools usually compile the component as a part of their process. |
Mmm i feel like this is probably in @dominikg territory...can you confirm if it's something to fix in |
FWIW I'm using Webpack, so if it is, it needs fixing in |
Uhm then maybe it's not will try to take a look |
This is not a runtime / bundler issue. This has to do with language tools. Your editor does not seem to use the typescript plugin - what IDE are you using? |
as a workaround or maybe even a better practice, export the type from a separate types.ts file? whats the usecase for exporting a type there? component props are the only ones i can think of rn but they should work without export |
Describe the bug
I cannot import types exported in a
<script module lang="ts">
block in a.svelte.ts
file (I can import them in other .svelte files).TS complains that:
Indeed, importing from
"*.svelte"
does actually work, but my editor thinks it's an error (and it sure does look wrong).Reproduction
https://stackblitz.com/edit/sveltejs-kit-template-default-umuyfhqp?file=src%2Froutes%2FOtherTest.svelte.ts
Logs
No response
System Info
Severity
blocking all usage of svelte
The text was updated successfully, but these errors were encountered: