mirror of https://github.com/sveltejs/svelte
fix: generate correct code for simple destructurings (#17237)
Fixes #17236 * fix: generate correct code for simple destructurings * add a test (existing one doesn't fail on main) * adjust existing test so it fails on main * slightly neater approach (with identical outcome) --------- Co-authored-by: Rich Harris <rich.harris@vercel.com>pull/17245/head
parent
d0e61bc252
commit
a7848c021a
@ -0,0 +1,5 @@
|
||||
---
|
||||
'svelte': patch
|
||||
---
|
||||
|
||||
fix: generate correct code for simple destructurings
|
||||
@ -1,13 +1,17 @@
|
||||
<script>
|
||||
let count = $state(1);
|
||||
|
||||
// More complex init
|
||||
let { squared, cubed } = $derived(await {
|
||||
squared: count ** 2,
|
||||
cubed: count ** 3
|
||||
});
|
||||
// Simple init with multiple destructurings after await
|
||||
let { toFixed, toString } = $derived(count);
|
||||
</script>
|
||||
|
||||
<button onclick={() => count++}>increment</button>
|
||||
|
||||
<p>{count} ** 2 = {squared}</p>
|
||||
<p>{count} ** 3 = {cubed}</p>
|
||||
<p>{typeof toFixed} {typeof toString}</p>
|
||||
|
||||
Loading…
Reference in new issue