Type mismatch between :key & v-for index
Version
3.0.11
Reproduction link
Steps to reproduce
Every project using typescript & having a v-for
Reproduction is just a dummy ts component with a v-for. Using it in VSCode with Volar will display the error
What is expected?
V-for "index" arg type is defined as:
const index: string | number | symbol
What is actually happening?
"Key" prop type is defined as:
(property) key?: string | number | undefined
As you can see, it is missing symbol coverage, producing type errors if we don't manually toString() or parseInt() the index in the template
I think this is about Volar and string | number
is recommended key type, not symbol
.
BTW, We recommend using sfc.vuejs.org to create a reproduction.
I can't reproduce this locally and your file download link doesn't seem to work (stuck at downloading)
Just pasting the content of the file directly here would be easier...
Duplicate of https://github.com/vuejs/vue-next/issues/2633