警告:找不到父tsconfig.json [英] Warning: Cannot find parent tsconfig.json

查看:3437
本文介绍了警告:找不到父tsconfig.json的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想修正警告:


警告:找不到父tsconfig.json

Warning: Cannot find parent tsconfig.json

IntelliJ IDEA 2016.3 中的TypeScript 错误标签中。我的TypeScript代码位于 src 目录中,而我的TypeScript输出按预期 lib 而没有 src 文件夹被添加到 lib

in the TypeScript Errors tab in IntelliJ IDEA 2016.3. My TypeScript code lives in the src directory and my TypeScript output is going to lib as expected without the src folder being added to lib.

我消耗 lib 其他项目中的文件夹,似乎按预期工作。所以这似乎不是一个大问题,但我偶尔会遇到TSLint的问题,它有时似乎没有拿起 .tsx 文件是JSX和lints不正确,似乎偶尔将其视为正常的 .ts 文件。最终它似乎弄明白了。我想知道这是否相关,因为我的TSLint设置被配置为使用 tsconfig.json

I consume the lib folder in other projects and it seems to work as expected. So this doesn't seem to be a big problem, but I occasionally have a problem with TSLint where it sometimes does not seem to pick up a .tsx file is JSX and lints incorrectly and seems to occasionally treat it as a normal .ts file. Eventually it seems to figure it out. I am wondering if that is related as my TSLint settings are configured to use tsconfig.json.

我之前还有 .js 转换后的文件出现在 .ts旁边 src 文件夹中的文件,但最近我修改了我的 tsconfig.json

I have also previously had .js transpiled files turn up next to the .ts files in the src folder, but not since I modified my tsconfig.json recently.

文件如下:

tsconfig.json
src/index.ts
lib/index.js
lib/index.d.ts

我已升级到TypeScript 2.1.4,但是在2.0.10时看到了它。

I've upgraded to TypeScript 2.1.4, but was seeing it with 2.0.10.

我的 tsconfig.json 档案:

{
  "compilerOptions": {
    "target": "es5",
    "module": "commonjs",
    "moduleResolution": "node",
    "jsx": "react",
    "allowJs": false,
    "isolatedModules": false,
    "experimentalDecorators": true,
    "emitDecoratorMetadata": true,
    "declaration": true,
    "noImplicitAny": false,
    "noImplicitUseStrict": true,
    "noEmitHelpers": false,
    "removeComments": true,
    "noLib": false,
    "sourceMap": true,
    "inlineSources": true,
    "preserveConstEnums": true,
    "allowSyntheticDefaultImports": true,
    "suppressImplicitAnyIndexErrors": true,
    "rootDir": "./src",
    "outDir": "./lib"
  },
  "include": [
    "./src/**/*"
  ],
  "compileOnSave": true,
  "atom": {
    "rewriteTsconfig": false
  }
}


推荐答案

问题特定于正在使用的TypeScript版本(2.1.x);它已在 2016.3中修复。 2 EAP

problem is specific to TypeScript version being used (2.1.x); it is fixed in 2016.3. 2 EAP

注意:此答案涉及IDE(WebStorm,PHPStorm,IDEA)版本2016.3特有的问题:它与TypeScript不兼容2.1.x,显示虚假警告。
如果您在其他IDE版本中看到类似的消息(找不到父tsconfig.json ),则可能是您的配置有问题:如果当前显示此类消息编辑 .ts 文件不包含在任何 tsconfig.json 中。

Note: this answer refers to the issue specific to IDE (WebStorm, PHPStorm, IDEA) version 2016.3: it didn't work well with TypeScript 2.1.x, showing false warnings. If you see similar message (Cannot find parent tsconfig.json) in other IDE versions, it is likely a problem with your configuration: such messages are displayed if currently edited .ts file is not included in any tsconfig.json.

这篇关于警告:找不到父tsconfig.json的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆