TypeScript错误:在Visual Studio中"无法写入文件...因为会覆盖输入文件"
大家好!我是TypeScript新手,在Visual Studio 2015中编写代码。通过NuGet安装了TypeScript 2.0。创建了一个简单的项目,其中有一个文件app.ts:
function greet(name: string) {
return `Hello, ${name}!`;
}
console.log(greet('World'));
在tsconfig.json中,我配置了以下内容:
{
"compilerOptions": {
"target": "es5",
"outDir": "./dist",
"rootDir": "./src"
},
"include": [
"src/**/*"
]
}
文件app.ts位于src文件夹中。尝试构建项目(Ctrl+Shift+B)时,出现以下错误:
Cannot write file 'C:/Projects/MyApp/dist/app.js' because it would overwrite input file.
我再次检查了:在dist文件夹中没有任何.ts文件。为什么编译器认为它会覆盖输入文件?如何解决这个问题?我尝试过删除文件夹