我有类型
interface Test {
Id?: string
Activity?: string
}
interface Previous {
Id?: string
Name?: string
Original: Test
}
interface MainProduct {
Id?: string
Name?: string
Original?: Previous
}
type Product = MainProduct | Previous
for (let activity in groupedProductsByActivity as Array<Product>) {
}
但这给了我一个编译时错误。谁能帮我如何将这种类型添加到for循环数据中?
谢谢。
错误是
Conversion of type 'Dictionary<(Previous | VIPClusterAssortmentProduct)[]>' to type '(Previous | MainProduct)[]' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first