I am currently building a project using Vue 3 (version 3.2.45), Typescript (version 4.9.4), and Vuetify (version 3.1.2).
When working with Vuetify components, I often encounter situations where I need to pass specific props for styling, positioning, or managing the visibility of the component through v-model. However, I sometimes run into an error message from the compiler that reads:
Type 'boolean' is not assignable to type 'never'
This error message seems to occur no matter what type I try to assign to the v-model property. Here's an example code snippet that triggers this error:
<template>
<div class="main-content">
<h2>Home</h2>
<v-dialog
v-model="dialog"
>
<template v-slot:activator="{ props }">
<v-btn
color="primary"
v-bind="props"
>
Open Dialog
</v-btn>
</template>
<v-card>
<v-card-text>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
</v-card-text>
<v-card-actions>
<v-btn color="primary" block @click="dialog = false">Close Dialog</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</div>
</template>
<script setup lang="ts">
import { ref } from "vue";
const dialog = ref(false);
</script>
In this scenario, the issue lies with the v-dialog component in Vuetify requiring the v-model to be of type boolean as per their official documentation ().
Although the code still functions correctly, seeing the red error message in my workspace bothers me.
This particular warning only seems to occur with Vuetify components, as I haven't experienced it with custom components that I create and define myself.
I'm unsure whether there is a way to configure my text editor (VS Code) to ignore this specific warning or if I might be making an error that triggers it.