typescript - 如何解决WebStorm中的 "Corresponding file not included in tsconfig.json"错误?

标签 typescript phpstorm webstorm typescript-typings tsconfig

我正在使用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",

我正在使用PhpStorm(它将WebStorm组件用于TypeScript)。

当我输入以下内容时:
Highland.Stream<any>

PhpStorm提示流:
Corresponding file not included in tsconfig.json

但是go声明起作用了,它跳转到node_modules/@types/highland/index.d.ts:367:
interface Stream<R> extends NodeJS.EventEmitter { ... }

我可以使用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"
  ]
}

我试图在types中添加高地无济于事,而且我也不知道错误告诉我什么。

最佳答案

我在Webstorm 2018中遇到了同样的问题。我关闭并重新打开了Webstorm,然后瞧,红线消失了!我只想刷新Webstorm。由于Webstorm和PHPStorm都位于同一保护伞下,因此也许这也将对您有用。

关于typescript - 如何解决WebStorm中的 "Corresponding file not included in tsconfig.json"错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41144902/

相关文章:

javascript - 类型 '{}' 无法分配给类型 'Readonly<IIdeasContainerProps>' 类型 '...' 中缺少属性 '{}'

ssh - 使用 SSH 代理部署 PhpStorm sftp

joomla - PhpStorm - Joomla 项目中的未定义类

typescript - typescript 中的传播运算符不保证正确的类型

javascript - jest.spyOn() 在 react 钩子(Hook)上调用时出现类型错误

php - 是否有用于编写/重构 PSR-1/2 兼容代码的 Netbeans/PHPStorm 插件(如 phphint.org)

keyboard-shortcuts - JetBrains IDE - 跳转到关闭 HTML 标签的键盘快捷键

node.js - 为什么带有nodeunit的nodejs测试用例在成功通过测试用例后仍然在webstorm中加载?

gulp - 使用 Webstorm 时 Watchify 不更新

javascript - 从我的项目中的不同文件夹/源调用文件