import React from 'react';
import { TypeInfo } from './proptypes';

const OneOf = ({ propType }) => <span>{propType.value.map(({ value }) => value).join(' | ')}</span>;

OneOf.propTypes = {
  propType: TypeInfo.isRequired,
};

export default OneOf;

import React from 'react';
import { TypeInfo } from './proptypes';

const joinValues = propType => propType.value.map(({ value }) => value).join(' | ');

const OneOf = ({ propType }) => (
  <span>{`oneOf ${Array.isArray(propType.value) ? joinValues(propType) : propType.value}`}</span>
);

OneOf.propTypes = {
  propType: TypeInfo.isRequired,
};

export default OneOf;

Add type check to PropType on OneOf