Consider a method
function getName(){
return this.name ;
}
now this method when called will have context of below class
class Person{
name:string
constructor(name){
this.name=name;
}
}
const person = new Person("Ujjwal");
getName.call(person);
the above implementation work but we don't get IntelliSense support or let's say I want to tightly couple the method with Person context.
Is there any way to achieve this?
NOTE: - I don't want to assign that getName method in class Person. getName will be always an independent method.