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能自己生成的 不要自己手打 真的容易敲错