everything included
<script lang="ts" setup>
This is the interface I am dealing with
interface Ms {
id: number;
username: string;
}
and this is the array of objects that I have
const list: Ms[] = [
{
id: 1,
username: 'mic',
},
{
id: 2,
username: 'mac',
},
]
currently, in Vue.js, my goal is to display all items as links
<a v-for="m in list" :key="m.id" :href="m.id">{{ m.name }}</a>
Everything works smoothly except for the error message I keep getting in my IDE (VSCode) for m.id
and m.name
, saying:
const m: unknown
Property 'id' does not exist on type 'unknown'.ts(2339)
const m: unknown
Property 'name' does not exist on type 'unknown'.ts(2339)
I can use m['id'] as a temporary fix, but I'm looking for a permanent solution.