sveltejs / svelte

Cybernetically enhanced web apps
https://svelte.dev
MIT License
78.12k stars 4.08k forks source link

Components with slot attribute can wrapped in `#if` statement do not produce any error/warning #9967

Open harshmandan opened 8 months ago

harshmandan commented 8 months ago

Describe the bug

Slots can't be wrapped in #if statements, but on using the slot with a component which is wrapped in #if statement, the compiler does not produce any error.

Reproduction

Here's a repo for reproduction:

https://stackblitz.com/edit/sveltejs-kit-template-default-wvmusb?file=src%2Froutes%2F%2Bpage.svelte

Here's a screenshot: Stackblitz

Logs

No response

System Info

Sveltekit v2.0.4

Severity

annoyance

fnimick commented 6 months ago

Not just on components, using <slot name="etc" for="etc" /> for slot forwarding inside an {#if $$slots.etc} block also silently fails.