-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
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
fix(props): handle misspelled keys on prop validation object #7198
Conversation
Thanks for the PR. Placing the check in |
@yyx990803 Thanks for info — moved to |
Thanks for the update - as I was reviewing again I realized the runtime cost can be further reduced by placing the check here when the options are normalized... (performed once per constructor) Also, even though this is dev-only code, I'd prefer to refactor to use a |
@yyx990803 done |
This warns about anything which relies on adding custom attributes to the prop object. For instance this: vue-leaflet/Vue2Leaflet#109. In another use-case, we add a I would suggest making this warning configurable somehow. |
A custom key |
What kind of change does this PR introduce? (check at least one)
Does this PR introduce a breaking change? (check one)
If yes, please describe the impact and migration path for existing applications:
The PR fulfills these requirements:
dev
branch for v2.x (or to a previous version branch), not themaster
branchfix #xxx[,#xxx]
, where "xxx" is the issue number)Other information:
When using object for validating props, there are no checks about object content. This may take a long time before noticing that you forget to pass required prop, but there are no warnings with a misprint.
Fail cases:
deafult: false
orrequire: true
P.S.: Will be great to add instance sections names validation, but I have no idea how to solve this (once I spent a lot of time before see that writed
component: {}
section insteadcomponents: {}
).