Skip to content

react/prop-types is missing in props validation on destructured prop types #2343

Closed
@reintroducing

Description

@reintroducing

I just recently upgraded to the latest version and started to see this. My component has proptypes that include

/** A notification to queue up for display. */
 notification: PropTypes.shape({...NotificationPropTypes}),

NotificationPropTypes are:

import PropTypes from 'prop-types';

export default {
    /** Additional class(es) to add to the component. */
    className: PropTypes.string,
    /** A unique ID to identify the notification with. The suggested way to create this is to use <a href="https://www.npmjs.com/package/uuid#quickstart---commonjs-recommended" target="_blank">uuid</a>. */
    id: PropTypes.string.isRequired,
    /** The message body of the notification. */
    message: PropTypes.node.isRequired,
    /** Determines the characteristics of the notification. */
    type: PropTypes.oneOf(['info', 'success', 'error', 'warning']),
    /** Whether to display the close button. */
    showClose: PropTypes.bool,
    /** The time (in milliseconds) that the notification stays open for. */
    duration: PropTypes.number,
    /** Whether the notification should close itself without having to click the close button after the specified duration. */
    autoClose: PropTypes.bool,
    /** A function to execute after the notification has been hidden. Will receive the notification's props. */
    onHidden: PropTypes.func
};

Offending code:

} else if (notification && !find(this._notificationQueue, {id: notification.id})) {

Its the notification.id part that its complaining about (id). Any reason why this would start to error now?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions