Skip to content

Warning in VScode for svelte(unused-export-let) when the prop is passed via <svelte:component> #8174

@laztheripper

Description

@laztheripper

Describe the bug

I have a filtered array of components to display, so I use
<svelte:component {id} this={tab} /> in the parent.

In the child components I have export let id = "";
However, vscode is telling me:

Component has unused export property 'id'. If it is for external reference only, please consider using `export const id`svelte(unused-export-let)

I am unsure where the warning is coming from, but the code does compile and the value can be read correctly on the front-end.
The only solution I've found to suppress the warning in my vscode editor is to add <!-- svelte-ignore unused-export-let --> to the top of every affected child component.

Thank you.

Reproduction

Parent

<script>
     import tab from './tab.svelte';
</script>

<svelte:component id='myid' this={tab} />

Child

<script>
     export let id = '';
</script>

Logs

No response

System Info

System:
    OS: Windows 10 10.0.19045
    CPU: (16) x64 AMD Ryzen 7 2700X Eight-Core Processor
    Memory: 17.17 GB / 31.95 GB
  Binaries:
    Node: 19.3.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.21.1 - ~\AppData\Roaming\npm\yarn.CMD
    npm: 9.2.0 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Chrome: 108.0.5359.125
    Edge: Spartan (44.19041.1266.0), Chromium (108.0.1462.76)
    Internet Explorer: 11.0.19041.1566

Severity

annoyance

Metadata

Metadata

Assignees

No one assigned

    Labels

    awaiting submitterneeds a reproduction, or clarification

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions