【问题标题】:error after updating Angular cli from 8 to 10将 Angular cli 从 8 更新到 10 后出错
【发布时间】:2020-12-13 03:32:28
【问题描述】:

我已将 Angular 项目从 8 升级到 10,但在编译时出现以下错误。

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');

我无法找出这里发生了什么。

谁能帮我解决这个问题?

提前致谢!

【问题讨论】:

标签: angular angular-cli angular-cli-v9


【解决方案1】:

由于 Angular 9 ModuleWithProviders 需要引用 NgModule 类型的泛型类型。

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

ngx-loading 项目尚未实现这些更改。但似乎 there is a pull request 正在等待完成。

【讨论】:

    猜你喜欢
    • 2019-11-25
    • 1970-01-01
    • 2020-12-20
    • 1970-01-01
    • 2019-10-27
    • 2020-05-01
    • 2021-01-02
    • 1970-01-01
    • 2021-03-01
    相关资源
    最近更新 更多