ModuleWithProviders< T>需要一种类型的参数-angular-autofocus-fix [英] ModuleWithProviders<T> requires 1 type argument(s) - angular-autofocus-fix

查看:100
本文介绍了ModuleWithProviders< T>需要一种类型的参数-angular-autofocus-fix的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

安装 angular-autofocus-fix

导入了AutofocusModule

imported the AutofocusModule

当我运行角度投影时,其显示以下错误:

When i run the angular projects its shows below error:

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

When i check in that node_mudule

我在项目中使用的是角度10.

I am using angular 10 in my project.

推荐答案

通过在 app.module.ts 的给定代码段下面添加此代码,解决了该问题

By adding this below given code snippet in app.module.ts fixed the issue

declare module "@angular/core" {
  interface ModuleWithProviders<T = any> {
    ngModule: Type<T>;
    providers?: Provider[];
  }
}

以我为例,当我在 angular-10 中升级 ng-bootstrap 版本时,会发生此问题.

In my case, this problem happened when I upgraded ng-bootstrap version in angular-10.

这篇关于ModuleWithProviders&lt; T&gt;需要一种类型的参数-angular-autofocus-fix的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆