1Basically, TypeScript is like an extension or "superset" of JavaScript.
2Since JavaScript is a loosely typed language,
3TypeScript enforces the strict use of types.
4Thus, making it a strictly typed language.
1interface LabelledValue {
2 label: string;
3}
4
5function printLabel(labelledObj: LabelledValue) {
6 console.log(labelledObj.label);
7}
8
9let myObj = {size: 10, label: "Size 10 Object"};
10printLabel(myObj);
11