Karma Angular - 找不到名字' X'

时间:2017-10-19 18:31:41

标签: javascript angular unit-testing karma-jasmine

在我的角项目中运行Karma Start时,我遇到了大量错误。

所有错误都说:'找不到名称Blob','找不到名称KeyboardEvent','找不到名称HTMLElement'等。

我的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"
    ]
  }
}

帮助!

1 个答案:

答案 0 :(得分:1)

添加" dom"到tsconfig.app.json中的lib修复了它