import React , { ComponentType } from 'react' ; const withProps = < T extends { } , P extends { } > ( propsMapper ) => ( BaseComponent ) : ComponentType < T & Partial < P > > => { const Hoc = ( props ) => { const newProps = { ... props , ... propsMapper ( props ) , } ; return < BaseComponent { ... newProps } / > ; } ; return Hoc ; } ; export default withProps ;