Search code examples
angularangular-cliangular-cli-v9

error after updating Angular cli from 8 to 10


I have upgraded my Angular project from 8 to 10 but while compiling I am getting the following error.

ERROR in node_modules/ngx-loading/lib/ngx-loading.module.d.ts:4:55 - error TS2314: Generic type 'ModuleWithProviders<T>' requires 1 type argument(s).

4     static forRoot(loadingConfig: INgxLoadingConfig): ModuleWithProviders;
                                                        ~~~~~~~~~~~~~~~~~~~
src/app/export/export.component.ts:83:24 - error TS2351: This expression is not constructable.
  Type 'typeof import("jspdf")' has no construct signatures.

83     const pdfDoc = new jsPDF('l');

I am not able to find out what is happening here.

can anyone please help me with this?

enter image description here

Thanks in Advance!


Solution

  • Since Angular 9 ModuleWithProviders needs generic type that refers to the type of the NgModule.

    https://angular.io/guide/migration-module-with-providers

    The ngx-loading project doesn't implement these changes, yet. But as it seems there is a pull request waiting to be done.