Consider the following class:
class Person {
name: string = 'Shachar';
age: number = 22;
printPerson() {
console.log(`name: ${this.name}, age: ${this.age}`);
}
}
Is there a way to get an interface with the properties that would be "own" by an instance of this class?
In this example, I want only the properties name and age, since printPerson will end up being part of the prototype of any instance, not own property.
Solutions that requires typing "name" and "age" explicitly are NOT acceptable since the class may have many properties and I would like to write them only once.