TS2322:类型“未知”不可分配给类型“{}”

时间:2021-06-11 09:55:54

标签: angular firebase

我在提到的问题中搜索了各种文章,但在该主题中找不到真正可用的答案...

我的应用中有一个“产品”对象。这与使用旧版本 Angular 的网店应用程序有关,在这种情况下,“product-form.component.ts”中有以下代码:

export class ProductFormComponent implements OnInit {
   categories$;
   product: {};

如果我以这种方式声明它,则会出现此错误:

enter image description here

当然在 ng serve 期间:

enter image description here

我该如何解决? 提前致谢!

附加信息: 角 CLI:11.2.13 节点:14.17.0 操作系统:达尔文 x64

1 个答案:

答案 0 :(得分:0)

不知何故,product: any; 解决了这个问题。