<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}