svelecte icon indicating copy to clipboard operation
svelecte copied to clipboard

Intellisense fails when importing directly from 'svelecte'

Open demetrius-mp opened this issue 2 years ago • 9 comments

when i import it like this:

<script lang="ts">
  import Svelecte from 'svelecte';
</script>

i dont have any intellisense when defining the props of the component

However, if i import it like this:

<script lang="ts">
  import Svelecte from 'svelecte/src/Svelecte.svelte';
</script>

i have the intellisense.

is it possible to provide the intellisense when doing the first import? im sure it is more convenient to import the component directly from svelecte instead of svelecte/src/...

demetrius-mp avatar Jan 23 '22 23:01 demetrius-mp

Also, isnt it possible to add some declaration files? i think there are some scripts that create them automatically based on the svelte component (such as this one)

demetrius-mp avatar Jan 23 '22 23:01 demetrius-mp

I have no experience with TypeScript, so if you can, prepare PR. I will hapilly merge it.

mskocik avatar Jan 24 '22 09:01 mskocik

hi, thanks for responding back! actually, i think that before doing the typescript thing, the issue of the import path should be solved first.

i've looked onto some other svelte component repos, such as svelte-select and sveltestrap, and i think this happens in your component because of the location and content of your index.js file.

on both of the repos i mentioned, it is are under the src/ directory, not the root directory. Also, on their index.js files, they only export the component(s), and nothing else (sveltestrap, svelte-select).

i'm not sure if i am able to help solving this, cause i have no knowledge at all on building components

demetrius-mp avatar Jan 24 '22 15:01 demetrius-mp

Okay that will be easy to fix, will take a look at it tomorrow

mskocik avatar Jan 24 '22 21:01 mskocik

thanks so much! once thats done, ill open another issue on typescript support and i might be able to help with it!

demetrius-mp avatar Jan 24 '22 21:01 demetrius-mp

also, consider moving component.js and item.js to src/

demetrius-mp avatar Jan 24 '22 21:01 demetrius-mp

Had problems with these, when testing it. The easiest solution would be to migrate whole package to svelte/kit (#49). But that's out of my time budget for now.

mskocik avatar Jan 25 '22 18:01 mskocik

I am also having an issue that has to do with this, I guess. image

Do you already have a rough approximation of the time, when the milestone v4.0 could be finished?

jbirtel avatar Jan 08 '24 12:01 jbirtel

Do you already have a rough approximation of the time, when the milestone v4.0 could be finished?

Can't promise you anything. I though I should be able to finish it by the end of the 2023. It's hard to find some time for it lately.

mskocik avatar Jan 09 '24 13:01 mskocik

Should be fixed in v4, due the moving to sveltekit, which should generate all types properly

mskocik avatar Feb 24 '24 11:02 mskocik