react-immutable-proptypes
react-immutable-proptypes copied to clipboard
.mapOf record fails
I tried to add our first mapOf test, which failed. While mapOf(ImmutablePropTypes.record)
fails, I can pass mapContains
with the same data. Yes, I checked wheter there are any non-records in the map - there are none.
Example:
const StackRecord = Record({
nodeId: null,
}, 'stack');
const myMap = Map(
['root', StackRecord({})],
['other', StackRecord({})],
['more', StackRecord({})],
);
// fails when tested against
ImmutablePropTypes.mapOf(ImmutablePropTypes.record).isRequired,
// passes
ImmutablePropTypes.mapContains({
root: ImmutablePropTypes.record.isRequired,
}).isRequired
When I put the Records in a List instead, it works fine with listOf(ImmutablePropTypes.record)
.
It's just mapOf that fails with the following message (library is the name of the property I check).
Invalid argument 'library[0]' of type 'array' supplied to 'Nav', expected 'Record'
Here is sample node project, demonstrating the issue. Just run it with node test.js
.
issue57.zip
This issue is a duplicate of #53, which a few forks already fixed a year ago. Apparently this repo is dead, so if anyone reads this, just replace your dependency with a fork by executing
yarn remove react-immutable-proptypes
yarn add mechanicalchopsticks/react-immutable-proptypes