Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ModuleWithProviders<T> requires 1 type argument(s) - angular-autofocus-fix

After installed angular-autofocus-fix

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

When i check in that node_mudule

I am using angular 10 in my project.

like image 411
Sky Talawar Avatar asked Dec 03 '22 17:12

Sky Talawar


1 Answers

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[];
  }
}

@NgModule({
  // ......
})
export class AppModule { }

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

like image 87
WasiF Avatar answered Jan 21 '23 07:01

WasiF