I'm using Vue 2 in a Nuxt app with @nuxtjs/composition-api and the following inside one of my components that has a custom v-model.
model: {
prop: 'modelValue',
event: 'change',
},
props: {
id: {
type: String,
required: true,
},
label: {
type: String,
default: '',
},
value: {
type: String,
default: '',
},
modelValue: {
type: [Boolean, Array],
default: false,
},
},
Template
<UiCheckbox id="checkbox" v-model="checkboxValue" label="abc" />
Script
setup() {
// Added any to silence the warning
const checkboxValue = ref<any>(false);
return { checkboxValue };
},
When I access to my component from outside, Typescript binds the value of a prop called value to v-model and not my custom prop modelValue. The inferred type is then wrong.
Is there a workaround for it Vue 2?