0

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 ...
        }
    }
})
Ilya Degtyarenko
  • 1,359
  • 8
  • 16

1 Answers1

0

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

Yaman Abd
  • 116
  • 1
  • 4