在 Vue.js 中使用 TypeScript 时遇到的 "Property does not exist on type 'never'" 错误
你好!我是 TypeScript 的新手,正在将其与 Vue.js 3 一起使用。我遇到了一个问题,已经困扰了我几个小时。
我有一个组件,通过 props 接收一个对象数组,并应在列表中显示它们。但是当我尝试访问数组内对象的属性时,TypeScript 报错:"Property 'name' does not exist on type 'never'"。
以下是我组件的简化代码:
```typescript
// ParentComponent.vue
```
```typescript
// ChildComponent.vue
- {{ item.name }}