Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.mapOf record fails #57

Open
bdurrer opened this issue Apr 18, 2019 · 2 comments
Open

.mapOf record fails #57

bdurrer opened this issue Apr 18, 2019 · 2 comments

Comments

@bdurrer
Copy link

bdurrer commented Apr 18, 2019

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'

@bdurrer
Copy link
Author

bdurrer commented Apr 23, 2019

Here is sample node project, demonstrating the issue. Just run it with node test.js.
issue57.zip

@bdurrer
Copy link
Author

bdurrer commented Apr 23, 2019

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant