-
Notifications
You must be signed in to change notification settings - Fork 12.8k
[ts] Duplicate function implementation #24925
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
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 // 1.ts
export {};
function test(){
console.log("File 1 Error");
} // 2.ts
export {};
function test(){
console.log("File 2 Error");
} |
@brikou Thanks a lot!
|
good |
This gives error in the console that |
Well, the suggested solution works if I'm using ES modules, but what about when I'm dealing with CommonJS modules? The same error occurs, but there doesn't appear to be a way to fix it. If I add |
If you’re writing .js files that you’re not going to compile, you can get the same effect of modulification with |
I guess I did something wrong before, because it's working now. Thanks, @andrewbranch! |
Steps to Reproduce:
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
Expected behavior:
Actual behavior:
Related Issues: #10804



The text was updated successfully, but these errors were encountered: