I'm getting started with TypeScript and at moment I'm following the TypeScript in 5 minutes guide. I'm receiving a strange warning in Visual Studio Code when I hover the mouse over the greeter
function name, as shown in the below image. The alert is:
[ts] Duplicate function implementation.
function greeter(person: Person): string (+1 overload)
But there is no other implementation of this unique function in my single file! When I run tsc greeter.ts
all works fine and the js file is generated.
The complete 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 receiving this alert? How to solve it? I took a look in this question, but I believe it isn't related.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…