angular-tree-component:通用类型 'ModuleWithProviders<T>' 需要 1 个类型参数

angular-tree-component:Generic type 'ModuleWithProviders<T>' requires 1 type argument(s)

我正在使用 angular v10 和 "angular-tree-component": "^8.5.6"。但是出现构建错误:

ERROR in node_modules/angular-tree-component/dist/angular-tree-component.d.ts:25:23 - error TS2314: Generic type 'ModuleWithProviders<T>' requires 1 type argument(s).

25     static forRoot(): ModuleWithProviders;

像这样在应用程序中使用

@NgModule({
  imports: [TreeModule],
   exports: [TreeModule]
   })

export class SharedModule { }

有什么需要修改的吗?

谢谢。

而不是“angular-tree-component”,使用新库“@circlon/angular-tree-component

npm uninstall angular-tree-component
npm i @circlon/angular-tree-component

然后,从以下位置更新项目中的所有导入:

import {TreeComponent} from 'angular-tree-component';

至:

import {TreeComponent} from '@circlon/angular-tree-component';

和css如果需要来自:

@import '~angular-tree-component/dist/angular-tree-component.css';

@import "~@circlon/angular-tree-component/css/angular-tree-component.css";