sveltejs/svelte

Svelte 5.43.0+: Function bindings and `await` in a single component cause an error

Closed this issue · 1 comments

Describe the bug

The following code causes an error:

<script lang="ts">
  const delay = (ms) => new Promise(resolve => setTimeout(resolve, ms))
  const test = await delay(1000)// <<< ❌ causes an error
  let width = $state(0)
  const updateWidth = (value: DOMRectReadOnly) => (width = value.width)
</script>

<div bind:contentRect={null, updateWidth}></div>
{width}
Image

Reproduction

Logs

System Info

-

Severity

annoyance

I think this is a dupe of #17090?