mirror of https://github.com/sveltejs/svelte
fix: remove bindable prop validation (#14946)
parent
9b71eea35d
commit
ce4f9722da
@ -0,0 +1,5 @@
|
||||
---
|
||||
'svelte': patch
|
||||
---
|
||||
|
||||
fix: remove bindable prop validation
|
@ -1,10 +0,0 @@
|
||||
import { test } from '../../test';
|
||||
|
||||
export default test({
|
||||
compileOptions: {
|
||||
dev: true // to ensure we we catch the error
|
||||
},
|
||||
error:
|
||||
'bind_invalid_export\n' +
|
||||
'Component counter/index.svelte has an export named `increment` that a consumer component is trying to access using `bind:increment`, which is disallowed. Instead, use `bind:this` (e.g. `<Counter bind:this={component} />`) and then access the property on the bound component instance (e.g. `component.increment`)'
|
||||
});
|
@ -1,8 +0,0 @@
|
||||
<script>
|
||||
let count = $state(0);
|
||||
export function increment() {
|
||||
count++;
|
||||
}
|
||||
</script>
|
||||
|
||||
{count}
|
@ -1,7 +0,0 @@
|
||||
<script>
|
||||
import Counter from './counter/index.svelte';
|
||||
let increment;
|
||||
</script>
|
||||
|
||||
<Counter bind:increment={increment} />
|
||||
<button onclick={increment}>increment</button>
|
@ -1,5 +0,0 @@
|
||||
<script>
|
||||
let { ...rest } = $props();
|
||||
</script>
|
||||
|
||||
{rest.count}
|
@ -1,13 +0,0 @@
|
||||
import { test } from '../../test';
|
||||
|
||||
export default test({
|
||||
compileOptions: {
|
||||
dev: true
|
||||
},
|
||||
|
||||
html: '0',
|
||||
|
||||
error:
|
||||
'bind_not_bindable\n' +
|
||||
'A component is attempting to bind to a non-bindable property `count` belonging to Counter.svelte (i.e. `<Counter bind:count={...}>`). To mark a property as bindable: `let { count = $bindable() } = $props()`'
|
||||
});
|
@ -1,7 +0,0 @@
|
||||
<script>
|
||||
import Counter from './Counter.svelte';
|
||||
|
||||
let count = $state(0);
|
||||
</script>
|
||||
|
||||
<Counter bind:count />
|
@ -1,5 +0,0 @@
|
||||
<script>
|
||||
let { count } = $props();
|
||||
</script>
|
||||
|
||||
{count}
|
@ -1,13 +0,0 @@
|
||||
import { test } from '../../test';
|
||||
|
||||
export default test({
|
||||
compileOptions: {
|
||||
dev: true
|
||||
},
|
||||
|
||||
html: '0',
|
||||
|
||||
error:
|
||||
'bind_not_bindable\n' +
|
||||
'A component is attempting to bind to a non-bindable property `count` belonging to Counter.svelte (i.e. `<Counter bind:count={...}>`). To mark a property as bindable: `let { count = $bindable() } = $props()`'
|
||||
});
|
@ -1,7 +0,0 @@
|
||||
<script>
|
||||
import Counter from './Counter.svelte';
|
||||
|
||||
let count = $state(0);
|
||||
</script>
|
||||
|
||||
<Counter bind:count />
|
Loading…
Reference in new issue