My goal is to create array of objects which have set default properties, but in some cases I will need to update one or more of property. Here is my example class with variables - objects
export class Components{
public static component_1 = {
width: 1,
height: 2,
x: 3,
y:4
}
public static component_2 = {
width: 10,
height: 20,
x: 30,
y:40
}
...
}
I would like to create my array of object in way eg
let myArrOfComponents = [Components.component_1, Components.component_2, ...]
The problem is that in some cases I will have to update one or more of properties in object, eg width and x. I would like to do this for example like
let myArrOfComponents = [Components.component_1.configure(width = 99, x=88)]
Can you help me how I can do this? Im not sure how implement '.configure()' I'm trying to solve this but have no idea how implement it or something with similar behavior