Karma Angular-找不到名称"X" [英] Karma Angular - Cannot Find Name 'X'
本文介绍了Karma Angular-找不到名称"X"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在我的角度项目中运行Karma Start
时,我遇到了很多错误.
I'm getting a load of errors when I run Karma Start
in my angular project.
所有错误都说:'找不到名称Blob','找不到名称KeyboardEvent','找不到名称HTMLElement'等.
All the errors say: 'Cannot find name Blob', 'Cannot Find name KeyboardEvent', 'Cannot find name HTMLElement', etc.
我的tsconfig.json:
my tsconfig.json:
{
"compileOnSave": false,
"compilerOptions": {
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"lib": [
"es2016",
"dom"
],
"typeRoots": [
"./node_modules/@types/"
],
"types": [
"jasmine",
"node",
"core-js"
]
}
}
帮助!
推荐答案
在tsconfig.app.json中将"dom"添加到lib进行了修复
adding "dom" to lib in tsconfig.app.json fixed it
这篇关于Karma Angular-找不到名称"X"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文