fix: allow deleting non-existent `$$restProps` properties (#12971)

fixes #12966
pull/12972/head
Simon H 3 months ago committed by GitHub
parent 213258b024
commit 75759dbeae
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -0,0 +1,5 @@
---
'svelte': patch
---
fix: allow deleting non-existent `$$restProps` properties

@ -130,7 +130,7 @@ const legacy_rest_props_handler = {
},
deleteProperty(target, key) {
// Svelte 4 allowed for deletions on $$restProps
if (target.exclude.includes(key)) return false;
if (target.exclude.includes(key)) return true;
target.exclude.push(key);
update(target.version);
return true;

@ -2,6 +2,8 @@
function prune() {
$$restProps.a
delete $$restProps.a
// should be idempotent
delete $$restProps.a
}
</script>

Loading…
Cancel
Save