Steps to Reproduce:
1) Create 1.ts file (Code as mentioned below)
2) Create 2.ts file (Code as mentioned below)
3) Create tsconfig.json using tsc -init. (This step is not mandatory)
4) Observer red underline under the function name
VS Code Version: 1.24.0
TypeScript Version: 2.3.4
OS Version: Windows 8.1 Enterprise
Search Terms: TypeScript Visual Studio Code [ts] Duplicate function implementation
Code
//1.ts File
function test(){
console.log("File 1 Error");
}
//2.ts File
function test(){
console.log("File 2 Error");
}
Expected behavior:
Actual behavior:
Related Issues: #10804



These functions are in the global scope and only one of them can exist at a time.
In order to prevent functions to be in global scope, you can add export {}; on top (or just export this function):
// 1.ts
export {};
function test(){
console.log("File 1 Error");
}
// 2.ts
export {};
function test(){
console.log("File 2 Error");
}
@brikou Thanks a lot!
export {}; ES module, local module scopegood
Most helpful comment
In order to prevent functions to be in global scope, you can add
export {};on top (or just export this function):see https://stackoverflow.com/questions/40900791/cannot-redeclare-block-scoped-variable-in-unrelated-files