react-immutable-proptypes icon indicating copy to clipboard operation
react-immutable-proptypes copied to clipboard

mapOf(contains()) throws warning

Open turnerhayes opened this issue 6 years ago • 0 comments

The problem seems like #23 but I'm still seeing it; my propType is:

payments: ImmutablePropTypes.mapOf(
      ImmutablePropTypes.contains({
        paidDate: PropTypes.oneOfType([
          PropTypes.number,
          PropTypes.instanceOf(Date),
        ]).isRequired,
        paidAmount: PropTypes.number.isRequired,
      }),
      PropTypes.number
    )

I get the following warning:

Invalid prop `payments[0]` of type `array` supplied to `MyComponent`, expected an Immutable.js Iterable

As mentioned in the aforementioned issue, it seems to be coming from the values being converted to arrays.

My react-immutable-proptypes version is 2.1.0.

turnerhayes avatar Mar 18 '19 00:03 turnerhayes