fix: check for falsy values in spread (#11388)

---------

Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
Co-authored-by: Simon Holthausen <simon.holthausen@vercel.com>
pull/11539/head
Fabio Rotondo 8 months ago committed by GitHub
parent f70c0370be
commit f219c795f4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -169,7 +169,7 @@ const spread_props_handler = {
has(target, key) { has(target, key) {
for (let p of target.props) { for (let p of target.props) {
if (is_function(p)) p = p(); if (is_function(p)) p = p();
if (key in p) return true; if (p != null && key in p) return true;
} }
return false; return false;

@ -0,0 +1,6 @@
<script>
$: x = Object.keys($$restProps).length;
$: y = Object.keys($$props).length;
</script>
{x} {y}

@ -0,0 +1,5 @@
import { test } from '../../test';
export default test({
html: '0 0'
});

@ -0,0 +1,5 @@
<script>
import Child from './Child.svelte'
</script>
<Child {...undefined} />
Loading…
Cancel
Save