如何在角度4中实现strictNullChecks
发布时间:2020-12-17 17:33:24 所属栏目:安全 来源:网络整理
导读:我试图在angular 4应用程序中实现strictNullChecks. 我刚刚在tsconfig.json中添加了“strictNullChecks”:true 当我运行应用程序ng服务时,我得到以下错误. ERROR in [at-loader] ./node_modules/@angular/forms/src/model.d.ts:244:39 TS2459: Type '{ only
我试图在angular 4应用程序中实现strictNullChecks.
我刚刚在tsconfig.json中添加了“strictNullChecks”:true 当我运行应用程序ng服务时,我得到以下错误. ERROR in [at-loader] ./node_modules/@angular/forms/src/model.d.ts:244:39 TS2459: Type '{ onlySelf?: boolean | undefined; emitEvent?: boolean | undefined; } | undefined' has no property 'emitEvent' and no string index signature.
解决方法
角度2.x-4x
启用strictNullChecks时,它会为包含库的所有TypeScript文件启用它. 要在Angular CLI项目中启用strictNullChecks,请在tsConfig中将skipLibCheck设置为true. Angular 5.x解决了这个问题. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |