Is there a way in javascript to selectively copy properties from one object to another? I am familiar with using Object.assign() for this purpose.
Specifically, I am looking to extract only the properties defined within the following interface:
export interface SizeOption {
width: number;
height: number;
unit: SizeUnit;
dpi?: number;
}
The use of Object.assign() is not suitable in my case as it does not account for getters and setters that need to be included along with the backing fields.
While Object.create() can capture both fields and methods, I am interested in extracting only the elements specified in the interface.