I cannot find any information about declaration and then initialization of class method, for example can I do this (code below), first declare getName()
and then initialize it, tslint tips me that I cannot do this, then what I should do, if doesn't want construction, like public getName(name: string): string { return this.name }
?
class Cat {
public getName(name: string): string;
constructor() { ... }
getName(name) {
return this.name;
}
}