Skip to content

docs(ts-support): annotating props with validators and default values #730

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

Merged
merged 4 commits into from
Dec 8, 2020

Conversation

JensDll
Copy link
Contributor

@JensDll JensDll commented Dec 5, 2020

Description of Problem

The example under Annotating Props in the TypeScript Support section of the docs would break the prop type for the component because of the validator function.

Proposed Solution

Give an example of how to correctly use validators and default values for objects and arrays.

Additional Information

Related issue

@JensDll JensDll changed the title docs(ts-support): annotating props with validators and default factory functions docs(ts-support): annotating props with validators and default values Dec 5, 2020
@JensDll JensDll force-pushed the ts-support-annotating-props branch from 1c28008 to 8c9bc9b Compare December 5, 2020 13:33
@NataliaTepluhina
Copy link
Member

@JensD98 thank you so much for this addition! The only fix here: could we reuse the example from above instead of changing it to use a different prop so readers would have a smooth transition?

@JensDll
Copy link
Contributor Author

JensDll commented Dec 5, 2020

@NataliaTepluhina I can see what you mean. However, I feel like having an object with three properties for demonstrating default values two times can get a bit lengthy. Would adding the numbers array prop to the example above already help?

@JensDll
Copy link
Contributor Author

JensDll commented Dec 5, 2020

I changed both examples to use the Book interface. Maybe this makes the most sense as it was already used a lot in other examples throughout the chapter.

Copy link
Member

@NataliaTepluhina NataliaTepluhina left a comment

Choose a reason for hiding this comment

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

@JensD98 thank you for the applied fixes! Looks good to me 👍🏻

@NataliaTepluhina NataliaTepluhina merged commit 7e65f12 into vuejs:master Dec 8, 2020
@JensDll JensDll deleted the ts-support-annotating-props branch December 8, 2020 16:34
fimion pushed a commit to fimion/docs-next that referenced this pull request Dec 21, 2020
…vuejs#730)

* docs(ts-support): annotating props with validators and default values

* docs(ts-support): annotating props added prop for number array

* added missing comma

* docs(ts-support): annotating props use the Book interface in examples
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants