sveltejs / svelte-preprocess

A ✨ magical ✨ Svelte preprocessor with sensible defaults and support for: PostCSS, SCSS, Less, Stylus, Coffeescript, TypeScript, Pug and much more.
MIT License
1.76k stars 151 forks source link

Add support for TS type within import brackets #511

Closed MathiasWP closed 1 year ago

MathiasWP commented 2 years ago

Is your feature request related to a problem? Please describe. VSCode automatically inserts a type import into the import-brackets when using autocomplete (valid TS syntax)

<script lang="ts">
import { my_store, type StoreEntry } from "$store"
</script>

This makes autocomplete for types cumbersome, because it requires a manual cleanup.

Describe the solution you'd like Add support for this syntax

Describe alternatives you've considered Performing it manually.

How important is this feature to you? I have to restructure the imports every time i import a type, which is frequently. Would appreciate this feature a lot - especially because Vite requires explicitly telling that an import is a type. This means that this feature will be useful for SvelteKit as well.

dummdidumm commented 2 years ago

I don't understand what exactly your problem is. Could you describe in more detail? The type StoreEntity syntax is correct and removes the type import when compiling, so that's what you want. This is also nothing svelte-preprocess explicitly needs to support, if you are using the latest TS version in your project this should work already.

dummdidumm commented 1 year ago

Closing due to inactivity and lack of reproduction.