Recently, I have made the switch from using Javascript to TypeScript. However, I am facing an issue while trying to delete data from a table in my code. Whenever I attempt to delete data, I encounter this error message:
Property 'id' does not exist on type 'never'.
Here is a snippet of my code:
<template #action>
<VButton color="danger" raised @click="deleteBrand" >Delete</VButton>
</template>
var deleteData = ref(null);
function deleteBrand() {
if(deleteData.value !== null)
directoryStore.deleteBrand(deleteData.value.id).then(() => {
deleteModalActive.value = false;
});
}
deleteBrand(id: number): any {
return new Promise((resolve,reject) => {
deleteBrand(id).then(() => {
resolve("deleted");
this.setBrands()
}).catch(() => {
reject('Nor Deleted');
})
})
},
This piece of code is part of a store component.