v-for type is unknown
Vue version
3.2.25
Link to minimal reproduction
Steps to reproduce
The warning message doesn't show up on SFC Playground, but I get unknown
type for group
in v-for="group in groupList"
What is expected?
group
should receive type IGroupTabData
since it is iterating an array of IGroupTabData
What is actually happening?
I get unknown
type for group
in v-for="group in groupList"
System Info
System:
OS: Linux 5.15 Ubuntu 22.04.1 LTS 22.04.1 LTS (Jammy Jellyfish)
CPU: (8) x64 Intel(R) Core(TM) i7-9700 CPU @ 3.00GHz
Memory: 5.97 GB / 15.45 GB
Container: Yes
Shell: 5.8.1 - /usr/bin/zsh
Binaries:
Node: 18.12.1 - ~/.nvm/versions/node/v18.12.1/bin/node
npm: 9.2.0 - ~/.nvm/versions/node/v18.12.1/bin/npm
Browsers:
Chrome: 107.0.5304.121
npmPackages:
vue: ^3.2.25 => 3.2.41
Any additional comments?
I am using VS code for my IDE. I solved this issue by doing type casting but I want to know if there's a better solution for this.
<p>{{ (group as IGroupTabData).name }}</p>
I've also tried below but it did not work:
const props = defineProps({
groupList: {
type: Array as PropType<IGroupTabData[]>,
default: []
}
});