Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems with Angular 9 (IVY): NgxMaskModule.forRoot returns a ModuleWithProviders type without a generic type argument #698

Closed
Josh961 opened this issue Mar 18, 2020 · 3 comments

Comments

@Josh961
Copy link

Josh961 commented Mar 18, 2020

I'm getting the following error when trying to import the ngx-mask module into my application following the startup guide. I've used this library successfully in lower versions of Angular.

NgxMaskModule.forRoot returns a ModuleWithProviders type without a generic type argument. Please add a generic type argument to the ModuleWithProviders type. If this occurrence is in library code you don't control, please contact the library authors.

static forRoot(configValue?: optionsConfig | (() => optionsConfig)): ModuleWithProviders;

My app.module.ts file:

import { HttpClientModule } from '@angular/common/http';
import { APP_INITIALIZER, NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { RouterModule } from '@angular/router';
import { IConfig, NgxMaskModule } from 'ngx-mask';
import { routes } from './app-routing.module';
import { AppComponent } from './app.component';
import { DashboardModule } from './modules/dashboard/dashboard.module';
import { ConfigService } from './services/config.service';

const appInitializerFn = (configService: ConfigService) => {
  return () => {
    return configService.loadAppConfig();
  };
};

export const options: Partial<IConfig> | (() => Partial<IConfig>) = null;

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    DashboardModule,
    HttpClientModule,
    NgxMaskModule.forRoot(options),
    RouterModule.forRoot(routes)
  ],
  providers: [
    {
      provide: APP_INITIALIZER,
      useFactory: appInitializerFn,
      multi: true,
      deps: [ConfigService]
    }
  ],
  bootstrap: [AppComponent]
})
export class AppModule { }
@Alberto-Monteiro
Copy link

Alberto-Monteiro commented Mar 25, 2020

Tenta usar
export const options: Partial<IConfig> | (() => Partial<IConfig>) = {};

@hajaniain
Copy link

hajaniain commented Apr 2, 2020

Remove node_modules folder, and rerun npm install

@NepipenkoIgor
Copy link
Collaborator

@hajaniain @Alberto-Monteiro @hajaniain @larini @bogdanconstantinescu Please try latest version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants