-
-
Notifications
You must be signed in to change notification settings - Fork 54
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
Typescript cannot resolve Vue Components (imported from a library) in Astro files #649
Comments
The ecosystem is kinda not well setup for this... The types it generates are all super Vue and Vue tooling specific. The same issue happens with Svelte. I'm not sure what's the best way to approach this at the moment. |
Hello @Princesseuh, the vue typings are really hard to reason about, you are right. Thank you for looking into this issue. |
I believe I was having issues with this too recently where my TypeScript checks were failing on a <Tag size="24">{ label }</Tag> As a workaround, I just removed the component and used static HTML since it was a rather simple component, but it would be nice to have this fixed as I felt like I had to introduce some tech debt in order to get around this issue. |
Having the same problem |
@Princesseuh, I was thinking, the type problems might be because of a wrong typescript setup somehow? I think it would be great to have an example setup for typescript that works in the documentation. I remember, that in lower versions of Astro we needed to setup some typescript to make it work. I could imagine, that this setup might be the problem. |
The problem in the OP is just that we don't (and honestly kinda cannot) really use the .d.ts generated by Vue, as the code they generate is specific to their tooling. No config changes can fix this, and there're no config changes required to use Astro and Vue together, as far as I'm aware |
Thanks @Princesseuh. I agree. I think with the latest versions of all extensions and packages it works as expected. |
Astro Info
If this issue only occurs in one browser, which browser is a problem?
No response
Describe the Bug
When importing a Vue component from a package/library, that is build width the vite library mode and has types declared with the
vite-plugin-dts
, then astro files cannot resolve the types for the props of the Vue component.Instead, a type error is shown:
The type declaration for this file looks like this (automatically generated during lib build):
A temporary fix for this is to whitelist all
IntrinsicAttributes
inastroHTML.JSX
, which will not break the typescript check, but is not really type safe.What's the expected result?
Astro files should be able to correctly interpret the typescript typings for imported Vue files with correct types for the Vue component properties.
This should also work for Vue Components, that are not imported from Vue SFC Files, but also when imported from build javascript files.
Link to Minimal Reproducible Example
https://stackblitz.com/edit/github-dggmu9
Participation
The text was updated successfully, but these errors were encountered: