Introduction Of TypeScript

As we all know that JavaScript is now everywhere, from front-end to back-end and in fact many desktop text editors are using JavaScript in the backend. So, as the complexity of the JavaScript application increases, it becomes more difficult to handle the code and protect it from messing with other codes.

Let get started with TypeScript.

TypeScript is ECMAScript 6 (ES6) with optional typing. Optional Typing means we can either declare the data type for the variable we use or we can directly use it by declaring it in plain format.

Like,

var variableName : string = “Irshad”;

OR

var variableName = “Irshad”;

By declaring types in your code allow IDEs and Text-Editors to give hint on autocompletion quickly without having to run your code.

For example, you will quickly get the error if we changed the parameter for the function call, as we have provided the type which declaring the function

introduction-of-typescript

Other text editor’s auto-completion is based on the code you have in your project files, so it doesn’t know anything about the type of each variable to you may end up passing variable with a similar name in your function and get the wrong output.

Moreover, with TypeScript code editors can have a more intelligent approach and suggest more appropriate variables to pass into functions and method calls.

So, it’s a real production boost as the code is written by itself as we type.

You can get the more info about TypeScript from its official website from here

Submit a Comment

Your email address will not be published. Required fields are marked *

Subscribe

Select Categories