Use Vue component's Props type parameter for prop type validation
See original GitHub issue- I have searched through existing issues
Feature Request
To use Vue component Props
type parameter for prop type validation feature.
Vue component type has dedicated Props
type parameter to represent props:
- Vue 2: 5th parameter of
CombinedVueInstance
https://github.com/vuejs/vue/blob/dev/types/vue.d.ts#L64 - Vue 3: 1st, 7th and 8th parameters of
ComponentPublicInstance
https://github.com/vuejs/vue-next/blob/master/packages/runtime-core/src/componentPublicInstance.ts#L163
By using it, we can validate any kind of component if it is properly typed. An example use case is Vue Class Component. I’m planning to introduce a new way to define component props and it will be quite a different API interface from the basic Vue’s prop definition. We can even use prop type validation with class component if we use Props
type parameter from the component.
It may also solve #2312 and #2343.
IssueHunt Summary
Backers (Total: $100.00)
- $100.00 have been anonymously funded.
Become a backer now!
Or submit a pull request to get the deposits!
Tips
- Checkout the Issuehunt explorer to discover more funded issues.
- Need some help from other developers? Add your repositories on IssueHunt to raise funds.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:11 (7 by maintainers)
Top Results From Across the Web
Props | Vue.js
Prop Validation #. Components can specify requirements for their props, such as the types you've already seen. If a requirement is not met,...
Read more >How to Use Props in Vue.js - freeCodeCamp
To specify the type of prop you want to use in Vue, you will use an object instead of an array. You'll use...
Read more >Vue Prop Type Validation | Pine Wu's Blog - matsu
How Prop Type Validation works · Collect each components' prop information and build interfaces such as __vlsComponentData__child . · For each ...
Read more >Vue Props Validation - Best Practices - Nordschool
The validator property allows you to create your own custom validator function. They are very handy for example when validating items of an ......
Read more >Validating Props in Vue - Owen Conti
Use Vue's built-in prop validators to validate your component's props.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
What is the status on this? Would love to see this working 😃
An anonymous user has funded $100.00 to this issue.