-
Notifications
You must be signed in to change notification settings - Fork 37
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
Opt-in to allowing unknown keys in a shape()
#116
Comments
Is there a use case for the current behavior (error on unknown keys)? I'd be willing to advocate for additional properties to be allowed as the default |
I wouldn't mind allowing additional properties by default, but that's a breaking change. I'd vote we first add the option to allow people to opt-in, then decide when we make our next breaking change if we want to change the default. |
Totally on board with that, just wanted to see if there was a reason explicitly for the previous behaviour |
Not that I know of. |
I had the same problem, I wondered about making Let me know if you'd like a PR with that (I know it's a duplication, but it does the job for me) |
Any progress on that? Have you guys decided if that will be a breaking or opt-in change? |
@gustaff-weldon Sorry, no progress that I'm aware of. I believe most people who had an interest in this issue have moved on to different companies. I'm not sure who will be maintaining this going forward. @cstolli may have some insight... |
@sglanzer I think it must be there. There are a lot of use cases to do so. |
@sunglam I'd agree that there are good use cases for it; I'm actually at a new company though and while we use prop-types this currently isn't a priority for me, nor do I direct the open source effort for Ciena ;) The best I can do at this moment is agree with you :) |
Currently, if a property defined as a
shape()
is given an object that meets that shape, but has additional properties, it will error because of the existence of unknown keys. Sometimes, consumers may want to specify what they expect, but not be upset if the user provides additional properties that they will simply ignore. It would be nice if we could support this by maybe accepting a second options block in theshape()
method, or a single,boolean
second argument for the purpose of enabling additional properties to be accepted:or
The text was updated successfully, but these errors were encountered: