简体   繁体   English

如何在IntelliJ IDEA中为TypeScript修复Mocha全局符号?

[英]How to fix Mocha global symbols for TypeScript in IntelliJ IDEA?

After installing Mocha typings from @types/mocha and configuring TypeScript compiler: @types/mocha安装Mocha @types/mocha并配置TypeScript编译器后:

{
  "compilerOptions": {
    "target": "es6",
    "module": "commonjs",
    "moduleResolution": "node",
    "noImplicitAny": true,
    "noUnusedLocals": true,
    "noUnusedParameters": false,
    "strictNullChecks": true,
    "sourceMap": true,
    "inlineSources": true,
    "newLine": "lf",
    "outDir": "target",
    "types": ["node", "mocha"],
    "typeRoots": ["./node_modules/@types"]
  },
  "exclude": [
    "node_modules",
    "target",
    "actors/test",
    "actors/typings"
  ]
}

I still get unresolved global symbol warnings/suggestions in IntelliJ IDEA visual editor for TypeScript Mocha tests: 在IntelliJ IDEA可视编辑器中,对于TypeScript Mocha测试,我仍然收到未解决的全局符号警告/建议:

截图

How do I fix that? 我该如何解决? The tests run successfully, but I get this annoying popup all the time when editing the test source code. 测试成功运行,但是在编辑测试源代码时,我总是得到这个烦人的弹出窗口。

将Mocha类型从5.2.2升级到5.2.5 (通过@lena),该问题得以解决。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM