Skip to content

No error for @render undefined if snippet function is state #12999

Closed
@rChaoz

Description

@rChaoz

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.

Case 1:

<script>
  let func = $state()
  $effect(() => {
    console.log(func === undefined) // true
  });
</script>

This doesn't throw: {@render func()}

Case 2:

<script>
  let func
  console.log(func === undefined) // true
</script>

This is an error: {@render func()}

Severity

annoyance

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions