[英]Angular CLI build --prod fails with tsconfig.json “noUnusedParameters” ser to true and Angular Material
我开始使用"noUnusedParameters": true
的"noUnusedParameters": true
和"noUnusedLocals": true
选项
我发现它们非常有用,可以使代码保持高亮显示,因为它们会产生明显的未使用导入和变量。
问题是,当我尝试使用ng build --prod
命令构建prod软件包时,出现很多类型的错误
ERROR in ng:///...../node_modules/@angular/material/form-field/typings/index.d.ts.MdFormField_Host.html (2,1): '$event' is declared but never used.
对于角材料组件,以及对于我的个人组件的类似错误,例如
ERROR in ng:///.../src/app/components/my-comp/my-comp.component.html (5,9): '$event' is declared but never used.
如果关闭tsconfig.json选项,一切正常,但是我想知道是否有解决此问题的方法。
我正在使用Angular 4.4.3和Angular Material 2.0.0-beta.11
看起来在angular / material github上已经合并了PR:
https://github.com/angular/material2/pull/4946
您的代码当然需要由您自己确定:]
也有一些讨论与角度/核心相关的问题:
https://github.com/angular/angular/issues/17131
建议之一是从tsconfig.json
删除noUnusedParameters
选项,并在tslint.json
使用no-unused
规则:
https://github.com/ajafff/tslint-consistent-codestyle/blob/master/docs/no-unused.md
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.