When I run ng serve I get this error:
error TS2314: Generic type 'ModuleWithProviders<T>' requires 1 type argument(s).
88 static forRoot(config: AuthConfig): ModuleWithProviders;
~~~~~~~~~~~~~~~~~~~
Here is my app.module.ts
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { FlashMessagesModule } from 'angular2-flash-messages';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { HomeComponent } from './home/home.component';
import { HeaderComponent } from './header/header.component';
import { RegComponent } from './reg/reg.component';
import { AuthComponent } from './auth/auth.component';
import { DashboardComponent } from './dashboard/dashboard.component';
import { AuthService } from './auth.service';
import { HttpModule} from '@angular/http';
@NgModule({
declarations: [
AppComponent,
HomeComponent,
HeaderComponent,
RegComponent,
AuthComponent,
DashboardComponent
],
imports: [
BrowserModule,
AppRoutingModule,
FormsModule,
FlashMessagesModule.forRoot(),
HttpModule
],
providers: [
AuthService
],
bootstrap: [AppComponent]
})
export class AppModule { }
Adding the following code in ../angular2-jwt/angular2-jwt.d.ts also helped me:
declare module "@angular/core" {
interface ModuleWithProviders<T = any> {
ngModule: Type<T>;
providers?: Provider[];
}
}
Angular CLI: 10.1.2
Node: 12.18.3
OS: Ubuntu 18.04.5 LTS
angular2-jwt dependency version: "0.2.3"
I hit on this error few days ago when migrating to Angular 10. You will need to update to @auth0/angular-jwt to 5.x. Please take note that there is some breaking changes.
Version v5 of this library has some breaking changes concerning the
allowedDomainsanddisallowedRoutes.
I hit on this error few days ago when migrating to Angular 10. You will need to update to
@auth0/angular-jwtto 5.x. Please take note that there is some breaking changes.Version v5 of this library has some breaking changes concerning the
allowedDomainsanddisallowedRoutes.
@tohjg ouhhh, bad mistake of mine%( Thanks for your help!
Most helpful comment
I hit on this error few days ago when migrating to Angular 10. You will need to update to
@auth0/angular-jwtto 5.x. Please take note that there is some breaking changes.