Typescript manual gives warning about "duplication of functions"

I'm starting with TypeScript, and I'm currently following TypeScript in 5 minutes . I get a strange warning in Visual Studio Code when I greeter over the name of the greeter function, as shown in the image below. A warning:

[ts] Implementation of duplicate functions.

Function greeter (person: Person): string (+1 overload)

Warning about the implementation of a repeating function.

But there is no other implementation of this unique function in my single file! When I run tsc greeter.ts everything works fine and a js file is created.

Full greeter.ts file:

 interface Person { firstName: string; lastName: string; } function greeter(person: Person) { return "Hello, " + person.firstName + " " + person.lastName; } var user = { firstName: "Jane", lastName: "User" }; console.log(greeter(user)); 

Why am I getting this warning? How to solve it? I have addressed this issue , but I believe that it is not related.

+8
javascript typescript
source share
1 answer

This seems to be a bug in Visual Studio code. GitHub has a few questions about this, like here and here . Remarks on these issues imply that this is a problem, then they were fixed and again became a problem in version 1.1.1.

It looks like the solution should run tsc --init to initialize tsconfig.json in the folder.

+11
source share

All Articles