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

derived and $derived cause lsp error #2605

Open
Pandoks opened this issue Nov 25, 2024 · 5 comments
Open

derived and $derived cause lsp error #2605

Pandoks opened this issue Nov 25, 2024 · 5 comments

Comments

@Pandoks
Copy link

Pandoks commented Nov 25, 2024

Describe the bug

When you import derived from svelte/store, it seems like $derived breaks the lsp.
image

Reproduction

Use derived from svelte/store in the same file as $derived

Logs

No response

System Info

System:
    OS: macOS 15.1.1
    CPU: (10) arm64 Apple M1 Max
    Memory: 13.46 GB / 64.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.5.0 - ~/.nvm/versions/node/v20.5.0/bin/node
    npm: 10.3.0 - ~/.nvm/versions/node/v20.5.0/bin/npm
    pnpm: 9.9.0 - ~/.nvm/versions/node/v20.5.0/bin/pnpm
    bun: 1.1.36 - /opt/homebrew/bin/bun
    Watchman: 2024.11.18.00 - /opt/homebrew/bin/watchman
  Browsers:
    Brave Browser: 131.1.73.91
    Safari: 18.1.1
  npmPackages:
    svelte: ^5.2.7 => 5.2.7

Severity

annoyance

@nmzein
Copy link

nmzein commented Nov 25, 2024

I might be wrong but I don't think theyre supposed to be used together in one file. What's stopping you from using a derived rune for the bottom example as well?

@Pandoks
Copy link
Author

Pandoks commented Nov 25, 2024

I might be wrong but I don't think theyre supposed to be used together in one file. What's stopping you from using a derived rune for the bottom example as well?

I was using superforms and I'm trying to synchronize the stores that are produced by it. I have other states and derived variables going on too. It'll probably be fixed as svelte deprecates more features, but for now it's kind of annoying. The code works though, but the dev exp is just really bad. See red everywhere.

@nmzein
Copy link

nmzein commented Nov 25, 2024

Yeah but you should be able to synchronise stores with $derived

@dummdidumm dummdidumm transferred this issue from sveltejs/svelte Nov 25, 2024
@Pandoks
Copy link
Author

Pandoks commented Nov 25, 2024

Yeah but you should be able to synchronise stores with $derived

oh i didn't even know that. there should be more info on migrating stores to runes. i know it's technically not a fully deprecated feature, but there isn't many examples of using stores together with runes. i thought if you used stores, you have to strictly use the stores api

@nmzein
Copy link

nmzein commented Nov 27, 2024

Yeah should prob be better documented but stores are fully compatible with the new runes stuff so you can use them in all runes including state, derived and effect. This is useful because it makes things like dealing with SvelteKit stuff that hasnt been migrated to runes yet easier without having to use deprecated apis

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

No branches or pull requests

2 participants