fix spreading of symbol properties onto component

pull/15045/head
Rich Harris 8 months ago
parent 85cc9bc613
commit bec570891a

@ -231,9 +231,14 @@ const spread_props_handler = {
for (let p of target.props) {
if (is_function(p)) p = p();
for (const key in p) {
if (!keys.includes(key)) keys.push(key);
}
for (const key of Object.getOwnPropertySymbols(p)) {
if (!keys.includes(key)) keys.push(key);
}
}
return keys;

@ -0,0 +1,5 @@
<script>
let props = $props();
</script>
<div {...props}></div>

@ -0,0 +1,6 @@
import { test } from '../../test';
export default test({
ssrHtml: `<div></div>`,
html: `<div>set from component</div>`
});

@ -0,0 +1,9 @@
<script>
import Child from './Child.svelte';
let stuff = $state({
[Symbol()]: (node) => node.textContent = 'set from component'
});
</script>
<Child {...stuff} />
Loading…
Cancel
Save