mirror of https://github.com/sveltejs/svelte
fix: improve prop binding warning validation for stores (#12745)
* fix: improve prop binding warning validation for stores * ts * address feedback * add comment * failing test * fix/simplify --------- Co-authored-by: Rich Harris <rich.harris@vercel.com>pull/12752/head
parent
d06174e461
commit
1942f87ed9
@ -0,0 +1,5 @@
|
||||
---
|
||||
'svelte': patch
|
||||
---
|
||||
|
||||
fix: improve prop binding warning validation for stores
|
@ -0,0 +1,5 @@
|
||||
<script>
|
||||
let { value = $bindable() } = $props();
|
||||
</script>
|
||||
|
||||
<input type="number" bind:value />
|
@ -0,0 +1,11 @@
|
||||
import { test } from '../../test';
|
||||
|
||||
export default test({
|
||||
mode: ['client'],
|
||||
compileOptions: {
|
||||
dev: true
|
||||
},
|
||||
async test({ warnings, assert }) {
|
||||
assert.deepEqual(warnings, []);
|
||||
}
|
||||
});
|
@ -0,0 +1,12 @@
|
||||
<script>
|
||||
import { writable } from 'svelte/store';
|
||||
import Child from './Child.svelte';
|
||||
|
||||
let a = writable({ value: 0 });
|
||||
let b = writable({ nested: { value: 0 } });
|
||||
</script>
|
||||
|
||||
<Child bind:value={$a.value} />
|
||||
<Child bind:value={$b.nested.value} />
|
||||
<p>{$a.value}</p>
|
||||
<p>{$b.nested.value}</p>
|
Loading…
Reference in new issue