New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Typescript errors for elements in v-for loop #3112
Comments
Think that's probably correct because you have optional chaining there so that means that it considers the iterated over type being |
Seeing the same problem too after the update when optional chaining is not being used so it is not linked to that. The same problem was present in v1.6.2, everything was ok in v1.6.1. |
It might help the author to fix it if you provide specific example. Ideally a repo. |
Having the same problem, quite easy to replicate it: <template>
<div v-for="item of testArray" :key="item.id">
{{ item.name }}
</div>
</template>
<script lang="ts">
import { defineComponent } from 'vue'
export default defineComponent({
setup() {
const testArray: any = [
{id: 'one', name: 'Test One'},
{id: 'two', name: 'Test Two'}
]
return {
testArray
}
}
})
</script> Previously (on versions < 1.6.2) item was 'any' type as well and not 'unknown' and had no error. |
same problem here, I have updated vue-tsc to latest version but the problem persists |
@mzuccaroli Would you mind opening a new issue with minimal reproduction? |
yes as soon as possible (I had some personal issues sory) |
After the update to Volar v1.63, elements of iterable objects with explicit type
any
in v-for loops are inferred as type unknownThe text was updated successfully, but these errors were encountered: