TypeScript – Quick view – Pt. 1

What is TypeScript?

  • TypeScript is a syntactic sugar for JavaScript.
  • TypeScript syntax is a superset of ES5 & ES6 syntax.
  • Every valid JavaScript code is also a TypeScript code.
The TypeScript compiler emits JavaScript. The TypeScript compiler performs only file-local transformations on TypeScript programs and does not re-order variables declared in TypeScript. This leads to JavaScript output that closely matches the TypeScript input.
TypeScript does not transform variable names, making tractable the direct debugging of emitted JavaScript. TypeScript optionally provides source maps, enabling source-level debugging. TypeScript tools typically emit JavaScript upon file save, preserving the test, edit, refresh cycle commonly used in JavaScript development.
It can improve your productivity by enabling rich tooling experience. TypeScript supports tools for large-scale JavaScript applications for any browser, for any host, on any OS. 

Why TypeScript?

JavaScript is standardized through the ECMAScript standards. TypeScript supports most of the latest ECMAScript features (the various posts under ECMAScript can be found here). Some of the interesting features of latest ECMAScript like modules, lambda functions, classes, the spread operator, destructuring, template literals are supported in TypeScript.

TypeScript makes JavaScript more and reliable by having following features

  • Optional static typing
  • Supports the latest JavaScript features
  • Supports classes, interfaces, generics
  • More productive than JavaScript

Optional static typing

JavaScript is dynamic type, it does not know type of variable until we initialize it. Typescript provides types support to code. Using static typing we can define the data type of the variable.

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.

example:

var y: any = “Clear Screen”;

Supports the latest JavaScript features

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.

More productive than JavaScript

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.

IDEs can help you throwing error right away when you are coding itself. So you can focus more on coding and less time at debugging. Enhanced IDEs provides greater support to this language which provides significant productivity compared working with JavaScript.

 

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.

 

Happy Coding!

9 thoughts on “TypeScript – Quick view – Pt. 1

  1. Alex January 21, 2018 / 9:59 am

    Excellent blog here! Additionally your web site loads up very fast! What web host are you the usage of? Can I am getting your affiliate hyperlink in your host? I desire my web site loaded up as quickly as yours lol

    Liked by 1 person

    • Pandiyan Murugan January 21, 2018 / 10:06 am

      Yup! thanks. I’m using WordPress 🙂 You can follow my blog for more interesting updates in future.

      Liked by 2 people

  2. Hattie Ray January 22, 2018 / 6:26 am

    I do believe all of the ideas you’ve introduced to your post. They’re really convincing and will certainly work. Still, the posts are very short for starters. Could you please lengthen them a bit from subsequent time? Thank you for the post.

    Liked by 1 person

  3. Lenore Scott January 22, 2018 / 7:08 am

    whoah this weblog is great i love reading your posts. Stay up the good work! You realize, many persons are looking round for this info, you can aid them greatly.

    Liked by 2 people

    • Pandiyan Murugan January 22, 2018 / 8:02 am

      Sure. Thanks, scott. We will be uploading new posts at regular intervals. stay connected, and follow the site you get notified of every new post.

      Liked by 1 person

  4. Danielle Callahan January 22, 2018 / 11:02 am

    F*ckin’ amazing things here. I am very satisfied to peer your article. Thanks so much and i’m taking a look ahead to contact you. Will you please drop me a mail?

    Liked by 1 person

Leave a comment