Closed colinblaise closed 2 years ago
There's a very simple work around.
Just don't use anonymous functions in template. Instead define a method and pass that to the reduce
prop.
Closing since my issue is resolved
This is a typescript error in your application code, not vue select. You can solve this by adding the type in your function declaration:
<v-select :reduce="(tag: { id: number }) => tag.id" />
I encountered the same issue and I'd add that it it true the solution is adding the type in a function declaration.
But we need to pass named type, not object literal.
:reduce="(tag: { id: number }) => tag.id" // remain TS error
:reduce="(tag: TagOption) => tag.id" // work!
Describe the bug A clear and concise description of what the bug is.
Reproduction Link A link to a reproduction of the bug. This is a huge help.
Steps To Reproduce Outline the steps to reproduce the bug.
Use vue-select with vue 2.7.6 and VS Code Volar extension
Expected behavior A clear and concise description of what you expected to happen.
Ideally it infers the type (maybe based on the options prop
Screenshots If applicable, add screenshots to help explain your problem.