Member-only story
Introduction to Typescript world — Part 3 : Important types
Before starting:
You can use typescript playground to execute and learn the below topics
Types in Typescripts:
In typescript we have to specify the type of each identifier ( variables), so that only actions for that particular type that is available is allowed to be called. This makes the code more safer and bug free
For example, if you say a variable “name” is of type “string” then you can call toUpperCase method , and it shows the autocomplete suggestions . You cannot call any other methods like toFixed() , toString() etc as it is available only for numbers .
You cannot also assign number or anything else to it as we already defined it as string. ( YES IN JAVASCRIPT YOU CAN ASSIGN WHAT EVER YOU WANT!!! I LOVED THE LANGUAGE FOR THAT REASON)
Now lets see what are different types available :