I'm currently going through a Laravel bootcamp and following along with the tutorial. However, I encountered an error when trying to display the model with VueJS using v-for loop. Here is my code:
type ChirpModel = {
id: number,
message: string,
created_at: string,
user: {
user_id: number,
name: string
}
}
const props = defineProps<{ chirps: Array<ChirpModel> }>()
and the v-for tags
<div class="mt-6 bg-white shadow-sm rounded-lg divide-y">
<Chirp v-for="c in props.chirps" :key="c.id" :chirp="c" />
</div>
Unfortunately, I'm receiving a type error:
https://i.sstatic.net/6Jqgw.png
If anyone could point me in the right direction for finding a solution, any tips would be greatly appreciated.
I've searched through forums but haven't been able to pinpoint where I've gone wrong.
I came across this question on Stack Overflow 'Item' is of type 'unknown' in vue3 v-for loop, but since I'm using Typescript, the solutions provided did not work in my case.