svelte
svelte copied to clipboard
No error for `@render undefined` if snippet function is state
Describe the bug
Currently, @render has no problem if it the snippet function is undefined if it's a state/prop, which is weird since it is a function call. Considering the {@render func?.()
syntax is supported, it should throw.
<script>
let func = $state()
$effect(() => {
console.log(func === undefined) // true
});
</script>
This doesn't throw: {@render func()}
<script>
let func
console.log(func === undefined) // true
</script>
This is an error: {@render func()}
Severity
annoyance