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

Component props as default values in #each destructuring #6964

Closed
janosh opened this issue Nov 27, 2021 · 2 comments · Fixed by #7007
Closed

Component props as default values in #each destructuring #6964

janosh opened this issue Nov 27, 2021 · 2 comments · Fixed by #7007
Labels
compiler Changes relating to the compiler

Comments

@janosh
Copy link
Contributor

janosh commented Nov 27, 2021

Describe the problem

I expected this to work without issues (REPL)

<script>
  export let defaultA = 1
</script>

{#each [{a: 2},{b: 3}] as {a = defaultA, b}}
  {a} {b}
{/each}

but I'm getting a compiler warning

App has unused export property 'defaultA'. If it is for external reference only, please consider using export const defaultA (2:12)

Describe the proposed solution

Silence the warning.

Alternatives considered

None

Importance

would make my life easier

@bluwy bluwy added the compiler Changes relating to the compiler label Nov 29, 2021
@Conduitry
Copy link
Member

This should be fixed now in 3.45.0 - https://svelte.dev/repl/79c5f5baa2bb4d2781d42b6142365cf4?version=3.45.0

@janosh
Copy link
Contributor Author

janosh commented Jan 7, 2022

@Conduitry Thanks! I assume the language server will continue to issue this warning until https://github.com/sveltejs/language-tools/blob/master/packages/language-server/package.json is updated to 3.45.0?

janosh added a commit to janosh/svelte-multiselect that referenced this issue Jan 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler Changes relating to the compiler
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants