33 * -----------------------------------------------------------------------------------------------*/
44
55import * as React from 'react' ;
6+
67import { composeRefs } from 'maverick.js/react' ;
78
89/* -------------------------------------------------------------------------------------------------
@@ -20,15 +21,15 @@ const Slot = React.forwardRef<HTMLElement, SlotProps>((props, forwardedRef) => {
2021
2122 if ( slottable ) {
2223 // the new element to render is the one passed as a child of `Slottable`
23- const newElement = slottable . props . children as React . ReactNode ;
24+ const newElement = ( slottable . props as { children : React . ReactNode } ) . children ;
2425
2526 const newChildren = childrenArray . map ( ( child ) => {
2627 if ( child === slottable ) {
2728 // because the new element will be the one rendered, we are only interested
2829 // in grabbing its children (`newElement.props.children`)
2930 if ( React . Children . count ( newElement ) > 1 ) return React . Children . only ( null ) ;
3031 return React . isValidElement ( newElement )
31- ? ( newElement . props . children as React . ReactNode )
32+ ? ( newElement . props as { children : React . ReactNode } ) . children
3233 : null ;
3334 } else {
3435 return child ;
@@ -66,7 +67,7 @@ const SlotClone = React.forwardRef<any, SlotCloneProps>((props, forwardedRef) =>
6667
6768 if ( React . isValidElement ( children ) ) {
6869 return React . cloneElement < any > ( children , {
69- ...mergeProps ( slotProps , children . props ) ,
70+ ...mergeProps ( slotProps , children . props as any ) ,
7071 ref : forwardedRef ? composeRefs ( forwardedRef , ( children as any ) . ref ) : ( children as any ) . ref ,
7172 } ) ;
7273 }
0 commit comments