Skip to content
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

Non-standard export of types #66

Open
MarcusOtter opened this issue Sep 14, 2023 · 1 comment
Open

Non-standard export of types #66

MarcusOtter opened this issue Sep 14, 2023 · 1 comment

Comments

@MarcusOtter
Copy link

Hi! I wanted to use this library in Astro but I ran into issues. However, other Svelte libraries that use flatpickr, for example carbon-components-svelte work fine.

This is some feedback I got from people more knowledgable about types:

[svelte-flatpickr] is very weirdly packaged, it only has a single export using a non-standard export name and it declares its types using a fake module

I don't really know how we would support that without implementing Svelte's module resolution I assume. If the package just exposed the files normally, you could just import the Svelte components.

I tried fixing this to open a pull request but I couldn't quite get it to work locally and I don't have time to look into it more. I tried setting up a new project and following the instructions about packaging from the SvelteKit docs which gave me better types and made it work in Astro, but I couldn't figure out how to migrate this repository to the "correct" format without "starting from scratch".

I thought I'd leave an issue here to let you know that a more standard way of exporting the component and its types would be very helpful for Astro users and possibly others too!

@jacobmischka
Copy link
Owner

jacobmischka commented Sep 18, 2023

Yeah, the types are basically tacked on as an afterthought at this point. This library wasn't written in TypeScript, and at the time of writing SvelteKit didn't exist and there was no standard way to export types for Svelte libraries. To my recollection, Svelte didn't even support types when this package was authored.

For what it's worth, this package should be exposing the files normally, I'm not sure what that is referring to. Would definitely appreciate help here if anyone else is familiar with migration. The types right now were basically just intended for consumption by IDEs, which seems to work correctly, but not necessarily build tools. I'll try to take a look at integration with Astro one of these days, but help would definitely be appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants