Skip to content

Wrong missing-declaration warning when using let'ed variable on same node #6009

@dummdidumm

Description

@dummdidumm

Describe the bug
Wrong svelte(missing-declaration) warning when using a variable on the same slot node where it was instantiated via a let:X statement but using it before that instantiation.

To Reproduce
This code

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

<Bla>
	<div slot="foo" class:bar let:bar>.</div>
</Bla>

produces a wrong svelte(missing-declaration) warning for bar. If I put class:bar behind let:bar, the error goes away. Code compiles just fine in both cases.

Expected behavior
No warning.

Information about your Svelte project:
Any browser, any system, Svelte 3.32.3

Severity
Inconvenient, an easy workaround exists

Additional context
Originally reported by @brunnerh in sveltejs/language-tools#817 (comment)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions