I'm new to ts and I'm trying to deserialize a json to a statically typed object
like this
class Bar {
x:number;
y?:string;
}
interface IBar{
x:number;
y?:string;
}
var baz:IBar = JSON.parse(jsonString);
i want to know in this case what the difference between using
var baz:IBar = JSON.parse(jsonString);
and
var baz:Bar = JSON.parse(jsonString);
i have read Interfaces vs Types in TypeScript but it did not help