Basic
Primitive Types
number
string
boolean
null
undefined
void
any
never
unknown
Object Types
object
array
function
tuple
enum
Variable Types
let myStr: string;
let myVal: string = "Hello!";
let myNum: number;
let myNum: number = 9;
let myBool: boolean;
let myBool: boolean = true;
Type inference
let myStr = "test";
//typescript will know that it is of type string
let myNum = 888;
//typescript will know that it is of type number
let myBool = false;
//typescript will know that it is of type boolean
Any
//if you do no infer and do no define, by default, variable will be of type any
let mydata;
//typescript will not complain if you assign any text number of boolean to it
let myAny: any = "Hello";
myAny = 98;
myAny = true;