-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Added options for object-based props definition in API #2028
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
Conversation
- fixed a link to props section
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome work, and so fast! Thanks!
I noted two minor things.
Thanks for the blazing fast review, @LinusBorg! I've added some requested changes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this! I have a couple of suggestions – do you think they make sense?
Co-Authored-By: NataliaTepluhina <[email protected]>
Co-Authored-By: NataliaTepluhina <[email protected]>
Co-Authored-By: NataliaTepluhina <[email protected]>
Thanks @phanan! Yes, I agree, I forgot to mention warnings are thrown only on dev environment |
Looks great! I think it's good enough to merge now 👍 |
* feat: add API entry on props options - fixed a link to props section * fix: moved a link and added read-more types link * Update src/v2/api/index.md Co-Authored-By: NataliaTepluhina <[email protected]> * Update src/v2/api/index.md Co-Authored-By: NataliaTepluhina <[email protected]> * Update src/v2/api/index.md Co-Authored-By: NataliaTepluhina <[email protected]>
* feat: add API entry on props options - fixed a link to props section * fix: moved a link and added read-more types link * Update src/v2/api/index.md Co-Authored-By: NataliaTepluhina <[email protected]> * Update src/v2/api/index.md Co-Authored-By: NataliaTepluhina <[email protected]> * Update src/v2/api/index.md Co-Authored-By: NataliaTepluhina <[email protected]>
@@ -509,6 +509,15 @@ type: api | |||
|
|||
A list/hash of attributes that are exposed to accept data from the parent component. It has an Array-based simple syntax and an alternative Object-based syntax that allows advanced configurations such as type checking, custom validation and default values. | |||
|
|||
With Object-based syntax, you can use following options: | |||
- **type:** can be one of the following native constructors: `String`, `Number`, `Boolean`, `Array`, `Object`, `Date`, `Function`, `Symbol`, any custom constructor function or an array of those. Will check if a prop has a given type, and will throw a warning if it doesn't. [More information](../guide/components-props.html#Prop-Types) on prop types. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it better to wrap the object keys type, default, required and validator with backquotes? Because they are kinds of actual code somehow. 🤔
I will give a PR if you all don't mind.
Thanks.
I created a draft API entry describing all possible options we can have with Object-syntax prop. Also, I fixes a link @phanan mentioned in #2027.
Close #2027