-
-
Notifications
You must be signed in to change notification settings - Fork 21
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
Parse typescript components #12
Comments
Could you clarify what you mean? The use case for this library is to make plain Svelte components compatible with users who do use |
Svelte components that use I may be wrong here, but that's been my experience when using my own distributable Svelte components (written with |
Interesting. So you author components in TS and want them to be consumable by non-TS apps. Just thinking a loud here, but would the following work for you use case?
|
So I actually want to use them in TS apps, but Svelte/TS isn't smart enough to pick up on props etc without a declaration file for the component. But to your point, that doesn't really work anyway. Apps like Sapper that consume svelte components need the uncompiled For this issue though that's not really relevant. Use case is: using external TS components in TS apps, which requires the component to have a declaration, which would be great to generate with sveld |
Understood – that's a compelling use case. |
https://github.com/firefish5000/svelte2dts does something like this already but is not that shaped out as |
Ooh looks promising! I'll give it a try for my next component |
For anyone stumbling across the same problem, @betaboon has a nice solution for lang=ts: svelte-type-generator. |
sveld 0.8.0 does typescript preprocessing using svelte-preprocess with default options so it shouldn't error now in most cases. I still encountered an error when a component imports a .ts file. But was able to work around it by changing the .ts to a .svelte and wrapping everything in a |
It would be wonderful if Sveld could generate proper typescript declarations for typescript components (ie:
lang="ts
), rather than only JS-annotated types.The text was updated successfully, but these errors were encountered: