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

Improve PropTypes.oneOf warning for non-primitive values #5569

Closed

Conversation

shuaibiyy
Copy link

The improvement was suggested in #1919.

@zpao
Copy link
Member

zpao commented Nov 30, 2015

Thanks for giving this a shot. I'm going to come back to this shortly. There are a couple other changes to PropType handling that I'd like to get in first. I also don't know that I agree with what you've done in practice (objects and functions are valid values in enums).

@zpao zpao self-assigned this Nov 30, 2015
for (var i = 0; i < expectedValues.length; i++) {
if (expectedValues[i] !== null &&
(typeof expectedValues[i] === 'object' || typeof expectedValues[i] === 'function')

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected value can of type object/function, why restrict it?

@facebook-github-bot
Copy link

@shuaibiyy updated the pull request.

@gaearon
Copy link
Collaborator

gaearon commented Apr 14, 2016

This hasn’t been updated in a while in response to a request for changes so I’m closing.
Functions and objects are indeed valid values and oneOf() shouldn’t restrict their usage.

@gaearon gaearon closed this Apr 14, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants