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

Generic type 'ModuleWithProviders<T>' requires 1 type argument(s) #51

Closed
1 task
GipHub123 opened this issue Nov 26, 2020 · 4 comments
Closed
1 task

Comments

@GipHub123
Copy link

I'm submitting a ... (check one with "x")

  • [ X] bug report => search github for a similar issue or PR before submitting
  • feature request

Current behavior

Application build fails (ng serve).

Build at: 2020-11-26T15:21:33.331Z - Hash: 07cc26ecc4eccfd8ee1b - Time: 25670ms

Error: node_modules/ngx-skeleton-loader/lib/ngx-skeleton-loader.module.d.ts:3:23 - error TS2314: Generic type 'ModuleWithProviders<T>' requires 1 type argument(s).

3     static forRoot(): ModuleWithProviders;

Expected behavior

No warning

Reproduction of the problem

Build application with Angular 10 or greater.

Please tell us about your environment:

"ngx-skeleton-loader": "^2.6.0",

Angular CLI: 11.0.2
Node: 10.18.1
OS: win32 x64

Angular: 11.0.2
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... platform-server, router
Ivy Workspace: Yes

Package Version

@angular-devkit/architect 0.1100.0
@angular-devkit/build-angular 0.1100.2
@angular-devkit/core 11.0.0
@angular-devkit/schematics 11.0.2
@angular/cdk 11.0.0
@angular/material 11.0.0
@angular/material-moment-adapter 11.0.0
@nguniversal/builders 11.0.0
@nguniversal/express-engine 11.0.0
@schematics/angular 11.0.2
@schematics/update 0.1100.2
rxjs 6.6.3
typescript 4.0.5

@GipHub123
Copy link
Author

This should be quite trivial to fix.

export class NgxSkeletonLoaderModule {
  static forRoot(): ModuleWithProviders {
    return {
      ngModule: NgxSkeletonLoaderModule,
    };
  }
}

->

export class NgxSkeletonLoaderModule {
  static forRoot(): ModuleWithProviders<NgxSkeletonLoaderModule> {
    return {
      ngModule: NgxSkeletonLoaderModule,
    };
  }
}

@willmendesneto
Copy link
Owner

Hi @GipHub123 thanks for raising that issue! I just applied the fix in commit bb7ad60, so I'm closing this issue for now.

Please, update your app to use ngx-skeleton-loader@2.6.1 and you'll get the fix. One more time, thank you very much!

@Kiranchandranayak
Copy link

Hi,

Please find the below screenshots, As I’m facing the below issue with “@azure/msal-angular (0.1.2)” by migrating from Angular 15 to Angular 16.

I have tried certain ways to clear the below issue, But unable to find the solution.

Getting the issue with node-modules & also facing JavaScript Heap memory leak issue as below,

Error: node_modules/@azure/msal-angular/dist/msal.module.d.ts:6:41 - error TS2314: Generic type 'ModuleWithProviders'
requires 1 type argument(s).

error Screenshot

The below is my app.module.ts

MsalModule.forRoot({
clientID: ,
authority:https://login.microsoftonline.com/,
validateAuthority: true,
redirectUri: environment.redirectUrl,
cacheLocation: "sessionStorage",
postLogoutRedirectUri: environment.redirectUrl,
navigateToLoginRequestUrl: false,
popUp: false,
consentScopes: ["user.read"],
isAngular: true,
unprotectedResources: ["https://www.microsoft.com/en-us/"],
protectedResourceMap: protectedResourceMap,
logger: loggerCallback,
correlationId: "1000",
level: LogLevel.Info,
piiLoggingEnabled: true
}),

Anyone Please suggest me with the solution, As I have been stuck with this issue since long time.

@willmendesneto
Copy link
Owner

@Kiranchandranayak The issue you're facing is solved. This is a matter of passing a generics into ModuleWithProviders<T>.

E.G: #51 (comment)

Commit fixing this issue: bb7ad60

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

3 participants