@@ -28,7 +28,7 @@ import { mergeProps } from "solid-js";
2828``` ts
2929function mergeProps<T extends unknown []>(
3030 ... sources : T
31- ): Record < string , unknown >;
31+ ): MergeProps < T >;
3232```
3333
3434## Parameters
@@ -41,13 +41,13 @@ Prop sources to merge.
4141
4242## Return value
4343
44- - ** Type:** ` Record<string, unknown >`
44+ - ** Type:** ` MergeProps<T >`
4545
46- Returns an object that resolves each property from the last source that defines it .
46+ Returns a merged object with lazy reactive property resolution across the provided sources .
4747
4848## Behavior
4949
50- - Later sources override earlier sources for the same property.
50+ - The last source with a non- ` undefined ` value for a property wins .
5151- Function sources are wrapped so property reads stay reactive.
5252- When reactive proxies are involved, the merged result uses proxy-backed property resolution.
5353- Property lookups are resolved when read rather than copied eagerly from every source.
@@ -59,15 +59,14 @@ Returns an object that resolves each property from the last source that defines
5959``` ts
6060import { mergeProps } from " solid-js" ;
6161
62- const props = mergeProps ({ name: " Smith" }, incomingProps );
63- ```
64-
65- ### Clone props
62+ // default props
63+ props = mergeProps ({ name: " Smith" }, props );
6664
67- ``` ts
68- import { mergeProps } from " solid-js " ;
65+ // clone props
66+ newProps = mergeProps ( props ) ;
6967
70- const clonedProps = mergeProps (props );
68+ // merge props
69+ props = mergeProps (props , otherProps );
7170```
7271
7372## Related
0 commit comments