### Describe the bug ```svelte <script> let structured = $state({ handler() {} }) </script> {#if structured} {@const { handler } = structured} <button onclick={() => handler()}>click me</button> {/if} ``` Generates a corrupted component which fails with `Error: handler is not defined` This is due to the generated code: ```js const computed_const = $.derived(() => { const { handler } = structured; return { handler }; }); button.__click = [on_click, handler]; ``` where `handler` is not available outside the lexical scope of the derived closure. ### Reproduction [REPL](https://svelte-5-preview.vercel.app/#H4sIAAAAAAAAE1WNywrCMBBFf2UYXbRQ6L6kRb_DuKjpFIPppCQTQUL-XargY3kP53AzztZRxO6UkceFsMPjumKD8li3Ee_khLDB6FMwG1HRBLvKoFmLI4EoIRlJgSboYR9lFKoyXEeeHIWqhlyg1JpV--047-z8ExbNAPlgPEeBTwsF-n9p09QliXgGz8ZZc-tzVUM_fP_K8OKwkGrf6qA5t3YumrHBxU92tjRhJyFROZcn_W9DWAEBAAA=) ### Logs ```shell Error: handler is not defined ``` ### System Info ```shell svelte: 5.0.0-next.40 generate: "client" ``` ### Severity blocking an upgrade