Skip to content

.mapOf record fails #57

@bdurrer

Description

@bdurrer

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'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions