import React , { ComponentType , ReactNode , Component } from 'react' ; interface Mapper < In , Out > { ( inProps ) : Out ; } interface MapPropsOutput < In , Out > { ( comp ) : ComponentType < In > ; } export function mapProps < In , Out > ( mapper ) { return function mapPropsHoc ( Comp ) { class MapPropsHoc extends Component < In > { render ( ) { const mappedProps = mapper ( this . props ) ; return < Comp { ... mappedProps } / > ; } static displayName = `mapProps(${ Comp . displayName || Comp . name || 'Component' })` ; } return MapPropsHoc ; } ; }