'How to validate props? (vue3, composition-api, typescript)
How to use validator for props value in typescript?
type Props = {
name: string
type?: string // how to use "validator" ?
modelValue: any
}
const props = defineProps<Props>()
How to make it work as in the following declaration:
defineProps({
type: {
type: String,
validator(value) {
return ...
}
}
})
Solution 1:[1]
maybe this stack overflow answer would help you:
but usually, in cases like this, I just go to the official Vue Discord server and ask my questions there to get the best answer from the Vue core team
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Yaman Abd |
