"use strict";

var _propTypes = _interopRequireDefault(require("prop-types"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

_propTypes.default.array.hookType = 'array';
_propTypes.default.bool.hookType = 'bool';
_propTypes.default.func.hookType = 'func';
_propTypes.default.number.hookType = 'number';
_propTypes.default.object.hookType = 'object';
_propTypes.default.string.hookType = 'string';
_propTypes.default.symbol.hookType = 'symbol';
_propTypes.default.element.hookType = 'element';
_propTypes.default.node.hookType = 'element';
_propTypes.default.array.isRequired.hookType = 'array';
_propTypes.default.bool.isRequired.hookType = 'bool';
_propTypes.default.func.isRequired.hookType = 'func';
_propTypes.default.number.isRequired.hookType = 'number';
_propTypes.default.object.isRequired.hookType = 'object';
_propTypes.default.string.isRequired.hookType = 'string';
_propTypes.default.symbol.isRequired.hookType = 'symbol';
_propTypes.default.element.isRequired.hookType = 'element';
_propTypes.default.node.isRequired.hookType = 'element';

function proxy(fn, type) {
  let oneOf = fn;
  return (...args) => {
    let a = oneOf(...args);
    let type1 = Array.isArray(args) && Array.isArray(args[0]) ? `${type}[${args[0].map(data => typeof data === 'function' ? data.hookType //arrayOf shape complex type not mention
    : JSON.stringify(data))}]` : type;
    a.hookType = type1;

    if (a.isRequired) {
      a.isRequired.hookType = type1;
    }

    return a;
  };
}

_propTypes.default.oneOf = proxy(_propTypes.default.oneOf, 'enum');
_propTypes.default.oneOfType = proxy(_propTypes.default.oneOfType, 'union');
_propTypes.default.arrayOf = proxy(_propTypes.default.arrayOf, 'arrayOf');
_propTypes.default.shape = proxy(_propTypes.default.shape, 'shape'); // export default PropTypes;