I have a model class p
class P {
constructor(public ids: number[]) {
console.log(ids);
}
}
On calling service api I got response like :
var response: any = { ids: "this is string" }
Now when we create an instance of model P using 'response'
let p1 = new P(response.ids);
this should produce error : ids type mismatch
but there is no error.
Now question is How to reject response, if it doesn't match given model type?