【问题标题】:Karma Angular - Cannot Find Name 'X'Karma Angular - 找不到名称“X”
【发布时间】:2017-10-19 18:31:40
【问题描述】:

当我在我的 Angular 项目中运行 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"
    ]
  }
}

救命!

【问题讨论】:

    标签: javascript angular unit-testing karma-jasmine


    【解决方案1】:

    在 tsconfig.app.json 中将“dom”添加到 lib 修复它

    【讨论】:

      猜你喜欢
      • 2017-03-25
      • 2016-01-24
      • 2022-01-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-09-14
      • 2021-05-01
      相关资源
      最近更新 更多