title: PropTypes: How to check for an enum of objects?
body: <p>I have an array of possible fields:</p>
  
  <pre><code>export const fields = [
    { type: 'select', defaultValue: MAINTAIN, name: TENDENCY },
    { type: 'select', defaultValue: DISTANT_ACQUAINTANCE, name: GROUP },
    { type: 'input', defaultValue: '', name: FIRST_NAME },
    { type: 'input', defaultValue: '', name: LAST_NAME },
    { type: 'input', defaultValue: '', name: CITY },
    { type: 'input', defaultValue: '', name: COMPANY },
    { type: 'input', defaultValue: '', name: POSITION },
  ];
  </code></pre>
  
  <p>And e.g. <code>const FIRSTNAME = 'firstName';</code>.</p>
  
  <p>I render these fields in a <code>&lt;ContactCell /&gt;</code> component. I tried to do PropTypes checks like this:</p>
  
  <pre><code>ContactCell.propTypes = {
    field: PropTypes.oneOf(fields).isRequired,
    handleChange: PropTypes.func.isRequired,
    value: PropTypes.string.isRequired,
  };
  </code></pre>
  
  <p>But when I render a ContactCell like this:</p>
  
  <pre><code>const createContactCell = (props = {}) =&gt;
    render(&lt;ContactCell {...props} handleChange={() =&gt; {}} /&gt;);
  
  const props = {
    value: 'Mike',
    field: { type: 'input', defaultValue: '', name: 'firstName' },
  };
  createContactCell(props);
  </code></pre>
  
  <p>I get the error:</p>
  
  <pre><code>Warning: Failed prop type: Invalid prop `field` of value `[object Object]` supplied to `ContactCell`, expected one of [{"type":"select","defaultValue":"maintain","name":"tendency"},{"type":"select","defaultValue":"distantAcquaintance","name":"group"},{"type":"input","defaultValue":"","name":"firstName"},{"type":"input","defaultValue":"","name":"lastName"},{"type":"input","defaultValue":"","name":"city"},{"type":"input","defaultValue":"","name":"company"},{"type":"input","defaultValue":"","name":"position"}].
      in ContactCell
  </code></pre>
  
  <p>How do you properly do PropType checks with with an array of possible objects?</p>