属性错误

时间:2018-04-16 11:23:18

标签: angular typescript compiler-errors

经过4天或更长时间的调查,我在这里遇到同样的错误。我用角度写的JHipster创建了一个项目,我想测试它。 JHipster默认生成一些初学者测试代码。

我按照本教程enter link description here运行测试,但似乎出现了错误,并出现了一些错误。

我做了什么:

安装所有业力插件。 安装tslint,karma,jasmine,typscript 我输入src \ test \ javascript \ spec我使用命令纱线测试出现的错误是这样的:



ERROR: C:/Users/67563478/new_workspace/onconsup/src/main/webapp/app/entities/qu
mioterapia/quimioterapia-dialog.component.ts[31, 17]: Property 'activatedRoute'
is declared but its value is never read.
ERROR: C:/Users/67563478/new_workspace/onconsup/src/main/webapp/app/entities/ra
ioterapia/radioterapia-dialog.component.ts[31, 17]: Property 'activatedRoute' i
 declared but its value is never read.
ERROR: C:/Users/67563478/new_workspace/onconsup/src/main/webapp/app/entities/ot
o-tratamiento/otro-tratamiento-dialog.component.ts[33, 17]: Property 'activated
oute' is declared but its value is never read.
ERROR: C:/Users/67563478/new_workspace/onconsup/src/main/webapp/app/entities/fa
maco/farmaco-dialog.component.ts[9, 19]: 'Unidad' is declared but its value is
ever read.

npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! oncosup@0.0.0 lint: `tslint --project tsconfig.json -e 'node_modules/*
'`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the oncosup@0.0.0 lint script.
npm ERR! This is probably not a problem with npm. There is likely additional lo
ging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\67563478\AppData\Roaming\npm-cache\_logs\2018-04-11T08_51
27_128Z-debug.log
error An unexpected error occurred: "Command failed.
Exit code: 2
Command: C:\\Windows\\system32\\cmd.exe
Arguments: /d /s /c npm run lint && karma start src/test/javascript/karma.conf.
s
Directory: C:\\Users\\67563478\
ew_workspace\\onconsup
Output:
".
info If you think this is a bug, please open a bug report with the information
rovided in "C:\\Users\\67563478\
ew_workspace\\onconsup\\yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this com
and.




如果我删除它们,应用程序无法正常工作,如果我公开或将它们公开或没有公开/私有,那么错误就是其他问题(看看有问题)。enter link description here

我不能用这种方式进行测试,也不能用业力和黄瓜进行测试。这是同样的错误。

1 个答案:

答案 0 :(得分:0)

正如您所看到的,您已在构造函数activatedRoute中进行了初始化,但它从未在任何地方使用过。

这就是为什么,打字稿给你错误。删除未使用的东西以修复警告