Skip to content

Commit 22e790d

Browse files
committed
fix: prevent migration script from adding props. to the export let identifier
1 parent 3147287 commit 22e790d

File tree

4 files changed

+16
-1
lines changed

4 files changed

+16
-1
lines changed

.changeset/shaggy-seals-judge.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'svelte': patch
3+
---
4+
5+
fix: prevent migration script from adding `props.` to the `export let` identifier

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1514,7 +1514,7 @@ function handle_identifier(node, state, path) {
15141514
);
15151515
} else {
15161516
const binding = state.scope.get(node.name);
1517-
if (binding?.kind === 'bindable_prop') {
1517+
if (binding?.kind === 'bindable_prop' && binding.node !== node) {
15181518
state.str.prependLeft(/** @type {number} */ (node.start), `${state.names.props}.`);
15191519
}
15201520
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<script>
2+
export let stuff;
3+
4+
console.log($$props);
5+
</script>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<script>
2+
let { ...props } = $props();
3+
4+
console.log(props);
5+
</script>

0 commit comments

Comments
 (0)