TypeScript – Quick view – Pt. 1
What is TypeScript?
- Optional static typing
- Supports classes, interfaces, generics
Optional static typing
var x : string = "Make a smile";
Here we have declared a variable of type string. The popular data types available in TypeScript are Boolean, Number, String, Array, Tuple, Enum, Any, and etc.
We have mentioned TypeScript is optional static typing.
What does it mean?
It means, we don’t have to mention the exact type of variable always. If we don’t wish to mention the type of variable, we can user any type to declare the variables. Once we are initializing the any type variable, it will decide the type of variable based on the values.
var y: any = “Clear Screen”;
Most features of ECMAScript has been supported by TypeScript.
The latest features of ECMAScript like
are supported in TypeScript as well. We can discuss about those topics in upcoming blog posts.
If the developer is already familiar with any of the Object Oriented Programming, it will be easy for them to adopt to TypeScript. The syntax are similar to Object Oriented language like C#.
As C# developer, in my personal experience I felt learning and understanding the syntax of TypeScript is easy.
This is just an introductory post, we can discuss more topics under TypeScript in upcoming posts. Please share your thoughts in comments section and follow this site for more updates.