I need help finding a solution for the following issue
interface IName {
name:string;
}
let obj1:IName = {
name: "LINUS"
}
function profileInfo (age:number,location:string):string{
return `${this.name} is ${age} years old and is from ${location}` // << Error here as 'this' implicitly has type 'any' because it does not have a type annotation
}
// call
let res = profileInfo.call(obj1,23,'Bangkok')
console.log(res);
I was testing out the call method to bind obj1 with the profileInfo function.
If you have any suggestions or solutions, please share them.
The code works fine in regular JavaScript, though.