import { Children , PropsWithChildren , ReactElement , ReactNode } from 'react' ; export type PropsWithSlot = PropsWithChildren < { slot ? : string ; } > ; export const elementsWithoutSlot = ( elements , name ) : ReactNode | ReactNode [ ] => { return Children . map ( ( elements as ReactElement [ ] ) , ( element ) : ReactNode => { if ( element ?. props ?. slot === name ) return ; return element ; } ) ; } ; export const findSlot = ( elements , name ) : ReactNode => { return ( Children . toArray ( elements ) as ReactElement [ ] ) . find ( ( element ) : ReactNode => { return element ?. props ?. slot === name ; } ) ; } ;