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) #25

Open
ratkorle opened this issue Oct 29, 2020 · 8 comments
Open

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

ratkorle opened this issue Oct 29, 2020 · 8 comments

Comments

@ratkorle
Copy link

I have followed the set up instructions on: https://www.npmjs.com/package/angular-gtag

npm i angular-gtag

in app.module.ts:

GtagModule.forRoot({ trackingId: environment.GOOGLE_TAG_ID, trackPageviews: true }),

Angular version: 10.1.1

On ng serve I am getting this error:

ERROR in node_modules/angular-gtag/src/gtag.module.d.ts:4:41 - error TS2314: Generic type 'ModuleWithProviders<T>' requires 1 type argument(s).
 
 4     static forRoot(config: GtagConfig): ModuleWithProviders;

@IamSumitJangid
Copy link

Hello
To fix the error you need to edit this file in node_modules
gtag.module.d.ts.__ivy_ngcc_bak

you need to add the type **<GtagModule>** with the ModuleWithProviders
static forRoot(config: GtagConfig): ModuleWithProviders;

the output will look like this.
static forRoot(config: GtagConfig): ModuleWithProviders<GtagModule>;

then try **ng server**

it fixed for me.

@yorikworld
Copy link

The same with Angular 16.

@iamnaveenoff
Copy link

after updating my project to angular 16

am facing this issue

Error: node_modules/angular-gtag/src/gtag.module.d.ts:4:41 - error NG6005: GtagModule.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.

4 static forRoot(config: GtagConfig): ModuleWithProviders;

how to fix this is this compatible with angular 16 ?

@AstiV
Copy link

AstiV commented Feb 21, 2024

Same issue here... I guess there's no fix by the authors, yet?
@yorikworld @iamnaveenoff have you worked around this somehow? Without editing files in node modules? 😅

@yorikworld
Copy link

Same issue here... I guess there's no fix by the authors, yet? @yorikworld @iamnaveenoff have you worked around this somehow? Without editing files in node modules? 😅

Please, try to set "skipLibCheck": true in tsconfig file.

@SarathSri3233
Copy link

Same issue here.

node_modules/angular-gtag/src/gtag.module.d.ts:4:41 - error NG6005: GtagModule.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.

4 static forRoot(config: GtagConfig): ModuleWithProviders;

This issue occurred after updating from Angular 15 to Angular 16. It was working fine in Angular 15.

@nkrish7x
Copy link

Same issue here . It was working fine in angular 15 but broke in 16.

@yorikworld
Copy link

yorikworld commented Sep 13, 2024

It works for me. Angular 14.
GtagModule.forRoot({ trackingId: '', trackPageviews: true }),
And "skipLibCheck": true, in tsconfig.json

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

7 participants