class Person {
constructor(public firstName: string, public lastName: string) {
get fullName(): {
return this.firstName + this.fullName;
}
walk() {
console.log('Walking');
}
}
}
class Person {
constructor(public firstName: string, public lastName: string) {
get fullName(): {
return this.firstName + this.fullName;
}
walk() {
console.log('Walking');
}
}
}
Either do this (i.e., specify return type)
get fullName(): string {}
Or do this (i.e., don’t specify the return type at all):
get fullName() {}
Edit: you are trying to return the this.fullName in the method below which shouldn’t be done.
get fullName(): string {
return this.firstName + ' ' + this.lastName;
}