I created the following class:
export class MyItem {
public name: string;
public surname: string;
public category: string;
public address: string;
constructor();
constructor(name:string, surname: string, category: string, address?: string);
constructor(name:string, surname: string, category: string, address?: string) {
this.name = name;
this.surname = surname;
this.category = category;
this.address = address;
}
}
I get the following error:
Overload signature is not compatible with function implementation
I tried several ways to overload the constructor, the last one I tried is that I posted above (that I get from here).
But I still get the same error. What's wrong with my code?