Avatar ·

TypeScript Error: "Cannot write file ... because it would overwrite input file" in Visual Studio

Hello everyone! I'm new to TypeScript, writing in Visual Studio 2015. I installed TypeScript 2.0 via NuGet. I created a simple project with one file app.ts:

\n\n
function greet(name: string) {\n    return `Hello, ${name}!`;\n}\n\nconsole.log(greet('World'));
\n\n

In tsconfig.json I have:

\n\n
{\n    "compilerOptions": {\n        "target": "es5",\n        "outDir": "./dist",\n        "rootDir": "./src"\n    },\n    "include": [\n        "src/**/*"\n    ]\n}
\n\n

The app.ts file is located in the src folder. When I try to build the project (Ctrl+Shift+B), I get the error:

\n\n
Cannot write file 'C:/Projects/MyApp/dist/app.js' because it would overwrite input file.