Lets say I have a class C and an Instance of Object O (from JSON).
class C {
str:string;
num:number;
}
var o = JSON.parse ("{\"num\":123, \"str\":\"abc\"}");
Is there a way I can assign/initialize an instance of C with o and it checks for undefined values as well as for the type WITHOUT doing it by myself in a copy-constructor/function?
I'd like to get an error or exception if a value is missing/undefined or the type does not match.
Thanks!