I have a typescript object like this:
class myObj {
public param1,
public param2,
public param3
}
In my other object I have an array of that object
class otherObj {
public arrayOfMyObj:myObj[]
constructor(){
this.arrayOfMyObj = [{param1: "value", param2: "value"}]
}
}
However this code throws an error, because that first item in the JSON array does not match myObj exactly (it is missing param3) if there any way to make it optional or just not to check this? Obviously I would normally just create a new myObj
and populate it, however this is a very long, hard coded JSON array.