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

Svelte 5: Component Imports in TS files not behaving correctly #2297

Closed
abdel-17 opened this issue Feb 21, 2024 · 1 comment
Closed

Svelte 5: Component Imports in TS files not behaving correctly #2297

abdel-17 opened this issue Feb 21, 2024 · 1 comment
Labels
bug Something isn't working Fixed Fixed in master branch. Pending production release.

Comments

@abdel-17
Copy link

abdel-17 commented Feb 21, 2024

Describe the bug

If you try to import a Svelte component with a snippet in a TS file, the type is not inferred correctly.

Reproduction

// foo.ts
import Foo from "./Foo.svelte";
<!-- Foo.svelte -->
{#snippet foo()}
{/snippet}

Expected behaviour

The import should have the correct type.

Screen_Recording_2024-02-21_at_3.43.46_AM.mov

System Info

  • OS: MacOS 14.2.1
  • IDE: VSCode

Which package is the issue about?

No response

Additional Information, eg. Screenshots

No response

@abdel-17 abdel-17 added the bug Something isn't working label Feb 21, 2024
@dummdidumm
Copy link
Member

It happens because the TS plugin uses the Svelte version that comes bundled with the extension, which is 3.x - so the parser thinks this is an invalid tag. We need to adjust the TS plugin to search for the user's Svelte version on a best-effort basis, similar to how we do it in the language server already.

dummdidumm added a commit that referenced this issue Apr 25, 2024
Necessary for Svelte 5 which contains syntax our current built-in compiler version can't handle
#2297
dummdidumm added a commit that referenced this issue Apr 25, 2024
Necessary for Svelte 5 which contains syntax our current built-in compiler version can't handle
#2297
@dummdidumm dummdidumm added the Fixed Fixed in master branch. Pending production release. label Apr 25, 2024
dummdidumm added a commit that referenced this issue Apr 25, 2024
Necessary for Svelte 5 which contains syntax our current built-in compiler version can't handle
#2297
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Fixed Fixed in master branch. Pending production release.
Projects
None yet
Development

No branches or pull requests

2 participants