Typing of v-for :key does not accept symbol
Version
3.2.0-beta.7
Reproduction link
Steps to reproduce
- Use symbols as :key in a v-for.
- Compile component incl. template with TypeScript (vue-tsc --noEmit)
What is expected?
Vue allows using a symbol as a v-for :key. This is very useful in some situations, since symbols are an automatically unique primitive. I would expect the typing of v-for :key to include symbol.
What is actually happening?
The code works at runtime, but the type checking step complains that the provided v-for :key is not string | number | undefined.
Symbols have been officially supported as a v-for :key since Vue 2.5. For some reason, the typing (but not the functionality) regressed with Vue 3.0.
We noticed this bug after switching from Vue-cli to Vite, since Vite supports TypeScript in templates out-of-the-box.