validatedFactory = function(props, children) {
      var descriptor = factory.apply(this, arguments);

      for (var i = 1; i < arguments.length; i++) {
        validateChildKeys(arguments[i], descriptor.type);
      }

      var name = descriptor.type.displayName;
      if (propTypes) {
        checkPropTypes(
          name,
          propTypes,
          descriptor.props,
          ReactPropTypeLocations.prop
        );
      }
      if (contextTypes) {
        checkPropTypes(
          name,
          contextTypes,
          descriptor._context,
          ReactPropTypeLocations.context
        );
      }
      return descriptor;
    }
Wraps a descriptor factory function in another function which validates
the props and context of the descriptor and warns about any failed type
checks.

@param {function} factory The original descriptor factory
@param {object?} propTypes A prop type definition set
@param {object?} contextTypes A context type definition set
@return {object} The component descriptor, which may be invalid.
@private