I am working with a typescript object that looks like this:
class myObj {
public param1,
public param2,
public param3
}
In another object, I have an array of that same object
class otherObj {
public arrayOfMyObj:myObj[]
constructor(){
this.arrayOfMyObj = [{param1: "value", param2: "value"}]
}
}
However, when attempting to run this code, it throws an error because the first item in the JSON array does not exactly match myObj (it is missing param3). Could there be a way to make param3 optional or just skip checking for it altogether? Normally, I would create a new myObj
and populate it accordingly. However, in this case, the JSON array is long and hard-coded.