What is TypeScript, Advantages of Using TypeScript

What is TypeScript?

If you read by the definition, ”TypeScript is JavaScript for application-scale development.”

So TypeScript is not entirely new language it’s a super set of Javascript so that means any Valid Javascript code is also valid TypeScript Code, But TypeScript has additional features that do not exists in the current version of JavaScript supported by most browser in the industry.

Examples of Additional features in TypeScript, are Strong or Static Typing, Object-Oriented Features, Compile-Time errors and also it provides Great Trolling.

Advantages of Using TypeScript

Here are the list of advantage of using TypeScript

Strong or Static Typing

If you have worked with languages like java, C# you know that in this languages when we define a variable we needs to specify the type of that variable.

In TypeScript specifying a type is optional so we don’t have to use this feature but using this features makes our application more predictable and it also makes it easy to debug the application when something goes wrong.

Object-Oriented Features

TypeScript is also brings quite a few object oriented features that we have missed in JavaScript for a long time.

We have the concept of Classes, Interfaces, Constructors, access modifiers like public and private, fields, properties and so on.

Compile-Time errors

Another benefit of using TypeScript, in TypeScript we can catch errors at compile time it’s of at run time, of-course not all kinds of errors but lot of errors.

TypeScript to JavaScript Compile Process

So there is a compilation step included, so when we compile our TypeScript code we catch this errors and fix them before deploying our application on production.

Great Trolling

Finally Another benefit of using TypeScript is that we get access to some great tools out there.

One thing that I personally love about TypeScript is that the intelligence we in out code editors

What should you know before learning TypeScript.

This is very simple question, yes your thinking right of-course you will need to have basic knowledge of JavaScript.

Conclusion

So to conclude, TypeScript is beautiful language and it is basically a super set of javascript, so any valid Javascript code is also valid TypeScript Code.

The current browsers does not understand TypeScript and it’s very unlikely that there are going to support in the future, so we need to compile or more accurately Transpile our TypeScript code to JavaScript code so this is a part of building every typescript Application.

For example we use typescript in React as well in Angular Application and the process of compiling typescript code is preconfigured in those applications.

Whenever we build our applications TypeScript compiler kicks in and it Transpiles our TypeScript code into JavaScript code that browsers can understand.

What’s Next?

Next I would recommend to start playing with TypeScript to get your hands around and to do that you should configure typescript on system first, so here is a detail tutorial for you to install typescript and write your first program and compile it to javascript – How to install TypeScript and Write TypeScript Program

Yogesh Koli

Software engineer & Blogger live in India, has 8+ years of experience working with the Front-end and Back-end Web Application Development.

Recent Posts

Complete guide of using Laravel 6 Eloquent Subquery Enhancements

Learn How to use laravel frameworks new improved feature called Eloquent Subquery and get example…

1 year ago

3 Useful examples of using Array Map function in PHP – Best Practices

Learn how to use php array map function with easy and essential tutorial to modify…

1 year ago

Working with PHP Array Filter Function – Best Practices

Learn how to use php array filter function with easy and essential tutorial to filter…

1 year ago

How to add Access Modifiers with Constructor Parameters in TypeScript

Want to know how to refactor your Typescript class, Learn here utilising Typescript of the…

1 year ago

What is Access Modifiers and how to use Access Modifiers in TypeScript ?

What is Access Modifiers in typescript, how to use Access Modifiers, when to use them,…

1 year ago

Top 10 Super Useful Packages to Improve Laravel applications in 2019

This tutorial provide ultimate list of package those are top 10 on packagist and super…

1 year ago