-
-
Notifications
You must be signed in to change notification settings - Fork 200
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
Auto imports default to import type
#687
Comments
Can you provide more info? At what condition does it import it as type and what are you importing? |
@jasonlyu123 All non-Svelte Typescript imports (functions, constants, etc) are imported as types, and I'm importing from intellisense suggestions when writing a component. Is that what you meant? Happy to provide any other details. |
Yeah, that's what I meant, thanks. But I can't reproduce it. I only see the // Component.svelte
import type { abc } from './abc';
export let a: typeof abc; // abc.ts
export function abc() { } Can you try it on a fresh project and see if it exist?
|
Sorry I think I've narrowed it down more — seems to happen consistently when importing within an attribute string (eg: in Setting |
I still can't reproduce this given your description. Please post a snippet with a Svelte file, |
I also had this happening today for a simple |
By checking if import happens outside of script tags. If so, always remove it sveltejs#687
By checking if import happens outside of script tags. If so, always remove it #687
Describe the bug
Auto imports for Typescript modules in Svelte components always default to
import type { thing } from './thing.ts'
, even though I'm not importing types.To Reproduce
Expected behavior
Auto imports should only be imported as a type if you are explicitly importing an eported type.
System (please complete the following information):
The text was updated successfully, but these errors were encountered: