import * as React from 'react' ; export interface VisibleComponentProps { activeModules : any [ ] ; name : string ; } param WrappedComponent return export function isVisibleComponent < P > ( WrappedComponent ) { class extends React . Component return class VisibleComponent extends React . Component < P & VisibleComponentProps > { param componentName return isVisibleComponent = ( componentName ) => { const activeModules = this . props . activeModules || [ ] ; return activeModules . some ( ( activeModule ) => { if ( ! activeModule . name ) { return false ; } else { return activeModule . name === componentName ; } } ) ; } ; /**
         * The render function.
         */ render ( ) { const { activeModules , ... passThroughProps } = this . props ; const isVisible = this . isVisibleComponent ( this . props . name ) ; return ( isVisible ? < WrappedComponent { ... passThroughProps as P & VisibleComponentProps } / > : null ) ; } } ; }