Use type
// types
let n : Number = 1;
// arrays
let names : String[] = ["John", "Roman"];
// enums
enum Sport {Soccer, Tennis}
let mySport : Sport.Soccer;
// function
function getName() : String {
return "Roma";
}
// void function
function voidFunction() : void {
console.log("Hello!");
}
// interface
interface Person {
name: String;
//optional field
age?: Number;
}
let iam : Person = {name : "Roman", age : 30};