-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: don't emit assignment warnings for bindings
Also fixes the possibility of an infinite loop due to the property access during the dev time check fixes #14643
- Loading branch information
1 parent
8bee23e
commit cc9c43e
Showing
9 changed files
with
73 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'svelte': patch | ||
--- | ||
|
||
fix: don't emit assignment warnings for bindings |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
packages/svelte/tests/runtime-runes/samples/proxy-coercive-assignment-warning/Test.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<script> | ||
let { x = $bindable() } = $props(); | ||
$effect(() => { | ||
x = {}; | ||
}); | ||
export function soThatTestReturnsAnObject() { | ||
return x; | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
packages/svelte/tests/runtime-runes/samples/proxy-coercive-assignment-warning/main.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<script> | ||
import Test from './Test.svelte'; | ||
let entries = $state([]); | ||
let object = $state({ items: null }); | ||
</script> | ||
|
||
<button onclick={() => (object.items ??= []).push(object.items.length)}> | ||
items: {JSON.stringify(object.items)} | ||
</button> | ||
|
||
<!-- these should not emit warnings --> | ||
<div bind:this={entries[0]}>x</div> | ||
<Test bind:this={entries[1]}></Test> | ||
<Test bind:this={() => entries[2], (v) => (entries[2] = v)}></Test> | ||
<Test bind:x={entries[3]}></Test> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
7 changes: 0 additions & 7 deletions
7
...velte/tests/runtime-runes/samples/proxy-nullish-coalescing-assignment-warning/main.svelte
This file was deleted.
Oops, something went wrong.