Angular 9 Ivy-通用类型'ɵɵFactoryDe​​f'需要2个类型参数 [英] Angular 9 Ivy - Generic type 'ɵɵFactoryDef' requires 2 type argument(s)

查看:202
本文介绍了Angular 9 Ivy-通用类型'ɵɵFactoryDe​​f'需要2个类型参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

看起来像Angular Ivy尚未准备好.我正在尝试使用ivular构建我的项目,这是Angular 9的主要思想.许多库与此功能不兼容,其中一个库是@angular/flex-layout.材料和服务人员也有同样的问题.

Looks like Angular Ivy not ready yet. I'm trying to build my project using ivy which is the main idea for Angular 9. Many of libraries are not compatible with this feature, one of these library is @angular/flex-layout. Material and service-worker have the same problem as well.

使用ng build --prod --aot -c=production脚本构建项目后,我得到了:

After using ng build --prod --aot -c=production script to build my project I got:

                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/@angular/flex-layout/core/typings/media-trigger/media-trigger.d.ts:71:18 - error TS2314: Generic type 'ɵɵFactoryDef' requires 2 type argument(s).

71     static ɵfac: ɵngcc0.ɵɵFactoryDef<MediaTrigger>;
                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/@angular/flex-layout/extended/typings/show-hide/show-hide.d.ts:18:18 - error TS2314: Generic type 'ɵɵFactoryDef' requires 2 type argument(s).

18     static ɵfac: ɵngcc0.ɵɵFactoryDef<ShowHideStyleBuilder>;
                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/@angular/flex-layout/extended/typings/show-hide/show-hide.d.ts:49:18 - error TS2314: Generic type 'ɵɵFactoryDef' requires 2 type argument(s).

49     static ɵfac: ɵngcc0.ɵɵFactoryDef<ShowHideDirective>;

该错误的发生时间长于我上面所写的时间,我花了一些时间对此问题进行了很好的搜索,桌上没有任何内容,但是禁用了常春藤,这不是一个好选择.

The error longer than what I wrote above, I took my time to have a good search for this issue, nothing on the table but disabling ivy which is not a good option.

推荐答案

幸运的是,Angular 9.1已发布并解决了问题.升级到9.1后(通过运行ng update @angular/cli @angular/core),我删除了node_modules并再次重新安装.然后,我将打字稿从3.7.5升级到了3.8.3.现在ngcc工作正常,构建后我没有任何错误.

Fortunately, Angular 9.1 has been released and the problem solved. After upgrading to 9.1 (by running ng update @angular/cli @angular/core) I deleted my node_modules and reinstall it again. Then I upgraded my typescript from 3.7.5 to 3.8.3. Now the ngcc is working fine and I have no errors after building.

有关更多信息: 查看全文

登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆