[英]Adding another tsconfig.json file to project confuses tsc when finding definitions
我有一个使用typescript
的应用程序的文件结构,看起来与此类似。
./
./tsconfig.json
/typings /* typescript d.ts from typings */
/src
/sites
/wiki
/scripts
/typescript-file.ts
/typescript-file.ts
而且效果很好。 但我遇到一种情况,我想在/wiki/
目录中添加一个新的tsconfig.json
,以更改其在项目那部分中的行为方式。
乍一看似乎不错,但是每当我尝试在该目录上运行tsc
时,我都会收到一条通知,通知它无法在/typings/
目录中找到打字稿定义-这是一个更高的级别。
有什么我可以做的事情,不需要我将打字目录克隆到较低级别的文件夹中吗?
tsconfig.json
{
"compileOnSave": false,
"compilerOptions": {
"experimentalDecorators": true,
"stripInternal": true,
"noImplicitAny": false,
"removeComments": false,
"sourceMap": false,
"target": "es5",
"module": "commonjs",
"allowSyntheticDefaultImports": true,
"noEmitOnError": false,
"moduleResolution": "node",
"pretty": true,
"declaration": false
},
"exclude": [
"node_modules",
"bower_components",
]
}
tsconfig.json
{
"compileOnSave": true,
"compilerOptions": {
"module": "amd",
}
}
有几点想法。
一个,您是否反对引入files
属性? 我有一个tsconfig,具有以下文件属性:
"files": [
"typings/tsd.d.ts",
"src/main.ts",
...
]
src / main.ts导入的所有内容仍会编译。 您只需要指定导入图的入口点即可,这对我来说已经足够好了。
另一个更具争议的选项可能是通过符号链接将类型目录引入wiki目录,而不是手动复制它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.