Skip to content

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

Open
@RandyZ

Description

@RandyZ

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions