Skip to content

Commit 38738a8

Browse files
authored
Fix migration bug (#13729)
Ensure that $derived is only applied to Identifiers
1 parent f2f3c8b commit 38738a8

File tree

1 file changed

+1
-1
lines changed
  • packages/svelte/src/compiler/migrate

1 file changed

+1
-1
lines changed

packages/svelte/src/compiler/migrate/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -739,7 +739,7 @@ const instance_script = {
739739
);
740740
const bindings = ids.map((id) => state.scope.get(id.name));
741741
const reassigned_bindings = bindings.filter((b) => b?.reassigned);
742-
if (reassigned_bindings.length === 0 && !bindings.some((b) => b?.kind === 'store_sub')) {
742+
if (reassigned_bindings.length === 0 && !bindings.some((b) => b?.kind === 'store_sub') && node.body.expression.left.type === "Identifier") {
743743
let { start, end } = /** @type {{ start: number, end: number }} */ (
744744
node.body.expression.right
745745
);

0 commit comments

Comments
 (0)