I am working on a class that has private properties:
class A implements IA {
private id: number;
private name: string;
constructor(obj: IA) {
// Need to assign properties from obj here
}
}
My goal is to pass an object of type IA
with initialized values when creating an instance of A, and only update the properties in the class that I provide.
For example: new A({id: 1})
or new A({id: 1, name: "O"})
Can anyone guide me on how to achieve this in TypeScript?