Conversion of type ‘{ data: string; }‘ to type ‘HmCalendarSelectedDay‘ may be a mistake because neit

Conversion of type '{ data: string; }' to type 'HmCalendarSelectedDay' may be a mistake because neither type sufficiently overlaps with the other. Property 'date' is missing in type '{ data: string; }' but required in type 'HmCalendarSelectedDay'. <ArkTSCheck>

this.selectedDays = res.data.data.clockins.map(item => {
      return { data: item.createdAt } as HmCalendarSelectedDay
    })

这个错误提示表明您正在尝试将一个类型为 { data: string; } 的对象转换为 HmCalendarSelectedDay 类型,但这两个类型不匹配。HmCalendarSelectedDay 类型可能要求有一个名为 date 的属性,但您提供的对象中没有。

您需要确保要转换的对象具有 HmCalendarSelectedDay 类型所要求的所有属性,或者修改转换的逻辑以使其合理。

this.selectedDays = res.data.data.clockins.map(item => {
      return { date: item.createdAt } as HmCalendarSelectedDay
    })

如果修改后还报错,就从新加载一下代码,这个软件有点卡(也可能是我电脑卡)

划重点:能复制的or能自己生成的 不要自己手打 真的容易敲错  

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值