-
-
Notifications
You must be signed in to change notification settings - Fork 55
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
Astro doesn't aware about svelte props #599
Comments
I've run into the same issue, and after an hour of pulling my hair out I seem to have narrowed the issue to pnpm's (non-)hoisting behavior. Can you try adding a
then rerun Alternatively, you might also try removing If it's the same for you, then we're running into the same problem, where it seems like pnpm's default non-hoisting is causing problems for Astro's tooling-- this seems to be a recurring issue with Astro. The following issues seem relevant:
I'm not familiar with the astro codebase, so that's the extent to which I can trace back the origin/history/context of the issue; perhaps someone more in-the-know than me might now be able to help out here. |
On a somewhat related note: with
unless typescript is explicitly installed as a project-level dependency. Weirdly, the astro language server insists on loading typescript only from the project-level |
I tried stuff that @kwshi suggested. (alias) function FAB(_props: typeof Component.props): any
import FAB This fixes the problem with prop types for me. Astro components are aware of them, and IDE shows correct errors. But there is still an issue with code auto-completion. It seems to work quite inconsistently. One time props show up, the other time they don't. They never show up if you press Note: UPD: Updated project to the Astro 3 with @astrojs/svelte 4. Same behaviour. |
I also encountered this issue on Astro 3.4.3, I managed to fix it using just |
What version of
astro
are you using?2.8.3
Are you using an SSR adapter? If so, which one?
None
What package manager are you using?
pnpm
What operating system are you using?
Linux
What browser are you using?
Chrome
Describe the Bug
I add svelte into my new project with
pnpm astro add svelte
After writing some component with svelte using TS, I have a couple of typed props like
position
andwhereTo
:I'm adding this component directly to Astro page. But Astro doesn't seem to be aware about defined props because when I'm hovering over a component in
.astro
file typing looks like this:Types when importing svelte component into another svelte component works perfectly fine. Type when hovering over looks like this:
What's the expected result?
Proper types in
.astro
file. Or at least the opportunity to define them manually. I'm sorry if there is one, but I can't find information about it.Link to Minimal Reproducible Example
https://stackblitz.com/edit/github-njqqdd?file=src%2Fpages%2Findex.astro
Participation
The text was updated successfully, but these errors were encountered: