ModuleWithProviders<T> 需要 1 个类型参数 - angular-autofocus-fix
ModuleWithProviders<T> requires 1 type argument(s) - angular-autofocus-fix
安装后angular-autofocus-fix
导入了 AutofocusModule
当我 运行 时 angular 投影显示以下错误:
ERROR in node_modules/angular-autofocus-fix/index.d.ts:4:23 - error TS2314: Generic type 'ModuleWithProviders<T>' requires 1 type argument(s).
static forRoot(): ModuleWithProviders
当我登记入住时 node_mudule
我在我的项目中使用 angular 10。
它似乎没有为 Angular 10 更新,ModuleWithProviders 不能再没有泛型使用 (https://angular.io/guide/updating-to-version-10#new-removals-of-deprecated-apis)
关于它的回购协议有一个问题:https://github.com/korniychuk/angular-autofocus-fix/issues/14
通过在 app.module.ts
中的给定代码片段下方添加此内容,解决了问题
declare module "@angular/core" {
interface ModuleWithProviders<T = any> {
ngModule: Type<T>;
providers?: Provider[];
}
}
就我而言,这个问题发生在我在 angular-10
中升级 ng-bootstrap
版本时。
请尝试使用 Observable 解决此问题。
安装后angular-autofocus-fix
导入了 AutofocusModule
当我 运行 时 angular 投影显示以下错误:
ERROR in node_modules/angular-autofocus-fix/index.d.ts:4:23 - error TS2314: Generic type 'ModuleWithProviders<T>' requires 1 type argument(s).
static forRoot(): ModuleWithProviders
当我登记入住时 node_mudule
我在我的项目中使用 angular 10。
它似乎没有为 Angular 10 更新,ModuleWithProviders 不能再没有泛型使用 (https://angular.io/guide/updating-to-version-10#new-removals-of-deprecated-apis)
关于它的回购协议有一个问题:https://github.com/korniychuk/angular-autofocus-fix/issues/14
通过在 app.module.ts
中的给定代码片段下方添加此内容,解决了问题
declare module "@angular/core" {
interface ModuleWithProviders<T = any> {
ngModule: Type<T>;
providers?: Provider[];
}
}
就我而言,这个问题发生在我在 angular-10
中升级 ng-bootstrap
版本时。
请尝试使用 Observable 解决此问题。