Closed
Description
Describe the problem
A component author might choose to use rest props as an authoring convenience:
<script>
- let { a, b } = $props();
+ let { ...props } = $props();
</script>
-<p>{a} + {b} = {a + b}</p>
+<p>{props.a} + {props.b} = {props.a + props.b}</p>
It's not the pattern we promote (you can't specify fallback values or bindability), but it's a valid choice. Right now, this creates a rest_props
proxy, even though it's not strictly necessary in this component:
let props = $.rest_props($$props, []);
Describe the proposed solution
If the only times props
is referenced is in a non-computed member expression, we can skip the rest_props
call and treat props.a
as though there were a named a
prop.
Importance
nice to have