vueuse / vue-demi

🎩 Creates Universal Library for Vue 2 & 3
MIT License
2.9k stars 149 forks source link

vue3.3 + ts, when v-for the computed array, the item type reference error #240

Open RandyZ opened 11 months ago

RandyZ commented 11 months ago

I have the vueGridItems like this...

import { computed } from 'vue-demi'
...
const vueGridItems = computed(() => {return [{i:1}, {i:2}] })

and template

<grid-item v-for="item in vueGridItems" v-bind="item" >
    <WmqGridItem
      ref="itemRefs"
      :uk="childrenWmqGridItem[item.i].uk" 
      :itemConfig="childrenWmqGridItem[item.i]" 
      :itemDataContext="childrenDataContext[item.i]"
      :itemProps="childrenWmqGridItem[item.i].props"
      :itemOptions="childrenWmqGridItem[item.i].options"
      :schemaData="childrenWmqGridItem[item.i].itemData"
    />
</grid-item>

item.i can not predict prop i, item type is

true | { i: number; }[] | ReactiveEffect<{ i: number; }[]>

true make editor recognize prop i fail, I have no idea where predict true

vue: 3.3 vue-demi: 0.14.5 editor: vscode and Vue Language Features (Volar) v1.8.8