Given this example, I am trying to figure how to cast an Object to an interface (or a class):
interface Person {
firstName: string;
lastName: string;
}
var obj={firstName:"James", lastName:"Bond"} as Person;
console.log(typeof(obj));
I've tried class too, but the console is still showing as "object" or false, in this case I am expecting a "Person", when using class I have tried obj instanceof Person, which return's false