As I was going through the TypeScript handbook, I stumbled upon this example:
interface Shape {
color: string;
}
interface Square extends Shape {
sideLength: number;
}
var square = <Square>{};
square.color = "blue";
square.sideLength = 10;
I'm curious about what exactly <Square>{}
means. It seems like a strange syntax to me. Coming from a Java/C# background, it resembles a generic for an anonymous object. Can you explain what it is and what limitations there are when creating objects in this way?