import * as React from "react" ; export type MergeContextWithProps < C , P > = ( context : C , props : P ) => C & P ; function defaultMergeFn < C , P > ( context , props ) { return Object . assign ( { } , context , props ) ; } type Merge < L , R > = Pick < L , Exclude < keyof L , keyof R > > & Partial < R > ; export function connectContext < C , P > ( ContextConsumer , mergeContextWithProps = defaultMergeFn ) { return function ( Component ) { return function ( props ) { if ( ! ( ContextConsumer as any ) . currentValue as any instanceof Object ) { throw new Error ( `react-connect-context: the current value of the given context identifier is _not_ an object,
        and therefore cannot be passed as props to ${ Component . name }. Please check the value in the context
        and try again.

        More info: https://github.com/Contiamo/react-connect-context#gotchas` ) ; } return ( < ContextConsumer > { context => < Component { ... mergeContextWithProps ( context , props as P ) } />} < /ContextConsumer>); } ; } ; }