pull/12740/head
Dominic Gannaway 2 years ago
parent e66416bec7
commit bbcb7cf3d9

@ -0,0 +1,5 @@
---
'svelte': patch
---
fix: improve prop binding warning heuristics

@ -4,6 +4,7 @@ import * as e from './errors.js';
import { FILENAME } from '../../constants.js';
import { render_effect } from './reactivity/effects.js';
import * as w from './warnings.js';
import { STATE_SYMBOL } from './constants.js';
/** regex of all html void element names */
const void_element_names =
@ -109,6 +110,12 @@ export function validate_binding(binding, get_object, get_property, line, column
var object = get_object();
var property = get_property();
var value = untrack(() => object[property]);
// If we are binding to a state object, then we don't need to provide a warning
if (typeof value === 'object' && value !== null && STATE_SYMBOL in value) {
return;
}
var ran = false;

@ -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,5 @@
<script>
let arr = $state({});
</script>
<svelte:component this={undefined} bind:this={arr} />
Loading…
Cancel
Save