Closed cshaa closed 2 years ago
I've created a new SvelteKit project and copypasted Portal.svelte
there.
It does the trick, now it includes the type definitions.
You can check my fork, or get it from NPM.
@romkor If you're interested in migrating the project to SvelteKit (as recommended in this tutorial), I'll glagly assist you. If you want to modify your current build process to also produce .d.ts
, that's also fine I guess :)
Did you try import Portal from “svelte-portal/src/Portal.svelte”?
Nice, that does the trick! I guess there's no problem, then :)
However, you might consider making it work even with import Portal from "svelte-portal"
.
Trick is to keep backward compatibility for javascript users. Maybe it can be good idea just add types definition by hands))
I think that any modern Svelte project can handle the packages generated by SvelteKit. So, personally, I'd consider bumping the major version to 3 and migrating to the new structure. If it breaked anyone's setup, they'd either stay on the last version of svelte-portal, or would be motivated to use an up-to-date version of Svelte in their project.
However, you might feel it differently. If you want to just add the type definitions as a separate file, the Plot.svelte.d.ts
file from my fork might come in handy. I can also make a PR adding the type definitions if you want me to.
PR with Portal.svelte.d.ts
file will be useful.
Thanks!
Sorry for the delay! I've created PR #135.
Thanks, merged!
When I try to import the package in my Svelte project, I get the following error:
Looking at the svelte-portal folder in node_modules, there indeed isn't any
.d.ts
file.This is weird,
sveltekit package
should produce both a compiled.svelte
file as well as.d.ts
file. (For comparison, projects likesvelte-material-ui
do ship the.d.ts
files, and therefore work out-of-the-box.) Could you, by any chance, publish the package with the type definitions?