-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Closed
Labels
Description
Describe the bug
I have no idea how to characterize this situation, but this is my attempt to strip down to more or less a minimal repro from a component in an application of mine that was migrated incorrectly.
This:
<script>
export let data
$: ({ foo } = data)
import { blah } from './blah.js'
let bar
$: {
bar = []
let baz
}
</script>results in:
<script>
import { run } from 'svelte/legacy';
import { blah } from './blah.js'
/** @type {{data: any}} */
let { data } = $props();
let bar = $state(
let { foo } = $derived(data)
run(() => {
bar = []
let baz
});
</script>Interestingly, putting a ; after the let bar seems to fix this. None of the other automatic semicolons seem to help or matter if they're explicitly inserted.
If I remove any piece of this, it also no longer happens. (If you're wondering about the stray let baz, in my real application there is additional computation, and baz is a local variable involved in computing bar.)
Reproduction
Logs
No response
System Info
n/aSeverity
annoyance