如何在WebStorm中解决"tsconfig.json中未包含的对应文件"错误?

k0p*_*kus 8 phpstorm webstorm typescript tsconfig typescript-typings

我正在使用highland.js并安装了它的类型定义:

jq .dependencies package.json | grep highland
  "@types/highland": "https://registry.npmjs.org/@types/highland/-/highland-1.14.30.tgz",
  "highland": "^2.9.0",
Run Code Online (Sandbox Code Playgroud)

我正在使用PhpStorm(它使用TypeScript的WebStorm组件).

当我输入提示:

Highland.Stream<any>
Run Code Online (Sandbox Code Playgroud)

PhpStorm抱怨流:

Corresponding file not included in tsconfig.json
Run Code Online (Sandbox Code Playgroud)

错误的屏幕截图

然而,去声明工作并跳转到node_modules/@types/highland/index.d.ts:367:

interface Stream<R> extends NodeJS.EventEmitter { ... }
Run Code Online (Sandbox Code Playgroud)

我可以毫无错误地编译代码,tsc并且它按预期工作.什么是PhpStorm/WebStorm的问题?

$ jq . tsconfig.json
{
  "compilerOptions": {
    "module": "commonjs",
    "lib": [
      "es2016",
      "dom"
    ],
    "target": "es6",
    "noImplicitAny": true,
    "sourceMap": true,
    "outDir": "dist",
    "strictNullChecks": true,
    "skipLibCheck": true,
    "types": [
      "node",
      "mocha",
      "chai",
      "sinon"
    ]
  },
  "exclude": [
    "node_modules",
    "src/typings-custom/main.d.ts"
  ]
}
Run Code Online (Sandbox Code Playgroud)

我尝试添加高地types无济于事,我不知道错误告诉我什么.

小智 11

我在 Webstorm 2018 中遇到了同样的问题。我关闭并重新打开 Webstorm,瞧\xc3\xa0:红线消失了!我想我只是需要刷新 Webstorm。由于 Webstorm 和 PHPStorm 都在同一保护伞下,也许这也适合您。

\n


sel*_*lan 7

只要去就File > Repair IDE可以了。

  • 我怎么没见过这个 (2认同)