I have an interface
export interface MyRange {
min: number
max: number
}
inside a vue3 component I have a type
type SliderType = number | MyRange
and I want a property of the component, which would be the v-model, to be number or MyRange so I set
props: {
modelValue: {
type: Object as PropType<SliderType>,
required: true
}
}
in setup I init my v-model var
const modelValueCopy: Ref<SliderType> = ref(props.modelValue)
It works but I got the ts2322 error, that SliderType can't be assigned to number | null | undefined, and Range can't be assigned to number
any idea how to fix this?
I've tried this
props: {
modelValue: {
type: number | MyRange,
required: true
}
}
but it doesn't work