updated typing of key in VNodeProps (fix #4240) #4242
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue
#4240
Version
3.2.0-beta.7
Reproduction link
Reproduction link
Steps to reproduce
What was 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 was actually happening?
The code works at runtime, but the type checking step complains that the provided v-for :key is not string | number | undefined.
What is the fix doing?
Added type support for symbol for a v-for :key.
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.