online typescript compiler code example

Example 1: what is typescript

Basically, TypeScript is like an extension or "superset" of JavaScript.
Since JavaScript is a loosely typed language,
TypeScript enforces the strict use of types. 
Thus, making it a strictly typed language.

Example 2: typerscript online compiler

Try this one:
https://www.typescriptlang.org/play/

Example 3: typescript

interface LabelledValue {
  label: string;
}

function printLabel(labelledObj: LabelledValue) {
  console.log(labelledObj.label);
}

let myObj = {size: 10, label: "Size 10 Object"};
printLabel(myObj);