import * as React from "react";
import { shape } from "./shape";
export class ServiceProvider extends React.Component {
    /**
     * @param props
     * @param context
     */
    constructor(props, context) {
        super(props, context);
        this.serviceManager = props.serviceManager;
    }
    /**
     * @returns {{serviceManager: ServiceManager}}
     */
    getChildContext() {
        return { serviceManager: this.serviceManager };
    }
    /**
     * @returns {ReactElement<any>}
     */
    render() {
        return React.Children.only(this.props.children);
    }
}
/**
 * @type {{serviceManager: Validator<T>, children: Validator<any>}}
 */
ServiceProvider.propTypes = {
    serviceManager: shape.isRequired,
    children: React.PropTypes.element.isRequired
};
/**
 * @type {{serviceManager: Validator<T>}}
 */
ServiceProvider.childContextTypes = {
    serviceManager: shape.isRequired
};
