import * as React from 'react' ; import * as PropTypes from 'prop-types' ; import OlMap from 'ol/Map' ; import Logger from '@terrestris/base-util/dist/Logger' ; param WrappedComponent return export function mappify < P > ( WrappedComponent ) { class extends React . Component return class MappifiedComponent extends React . Component < Omit < P , 'map' > > { /**
         * The context types.
         */ static contextTypes = { map : PropTypes . instanceOf ( OlMap ) . isRequired } ; constructs constructor ( props ) { super ( props ) ; } /**
         * The render function.
         */ render ( ) { const { map } = this . context ; if ( ! map ) { Logger . warn ( 'You\'re trying to mappify a component without any map ' + 'in the context. Did you implement the MapProvider?' ) ; } return ( < WrappedComponent map = { map } { ... this . props as P } />); } } ; }