DEV Community

Cover image for Typescript for Dummies
Abhiraj Bhowmick
Abhiraj Bhowmick

Posted on • Updated on • Originally published at blog.abhiraj.co

Typescript for Dummies

I am sure that in your web development career you must have used JavaScript at least once. And I am sure you must have found it very useful and very powerful. But what if I say there is another language that is just as powerful as JavaScript and has way lesser bugs when compared to when you use JavaScript in your app.

That language is TypeScript.

What is TypeScript?

TypeScript is a programming language developed and maintained by Microsoft licensed. TypeScript is a superset of JavaScript, meaning that all the concepts of JavaScript are present in TypeScript which is combined with TypeScript's own concepts that make the language increasingly powerful.

If you know JavaScript, it mustn't be a problem switching to TypeScript as it essentially has the same concepts as JavaScript except a few of TypeScript's own concepts.

Advantages

So what are the advantages of using TypeScript?

  • Concepts similar to JavaScript
    TypeScript has similar concepts as JavaScript which makes the switch seamless

  • TypeScript is type-safe
    This means that you have to define the type of the variable before initializing it.
    Making your code type-safe decreases the number of bugs evolved in your app over time and makes it cleaner.
    Types give superior integration to your editor which improves editor support meaning increased developer productivity and gives you a better codebase.

  • It keeps JavaScript in check
    TypeScript keeps your JavaScript in check. Meaning that it validates your code before it's even run which gives you an edge over using simple JavaScript.

  • Runs on multiple places
    TypeScript runs in multiple places. It converts your JavaScript which can be run on the web, on a phone, or on Node.js.

  • Type Inference
    It uses something called type inference which is nothing but adding types to your code which gives safety enabled without you writing long and additional lines of code making your app faster and scalable.

  • It is developed and maintained by Microsoft
    TypeScript is developed and maintained by Microsoft and widely used by many companies which means it's nowhere near to reaching its end. So you can expect regular updates and fixes to the language.

Why shift?

Let's move on to some testimonials!

TypeScript is widely used and loved by developers around the world. Here are some testimonials given by popular companies which is another indication that switching to TypeScript is worth it.

  • According to Slack, the switch to TypeScript made their life a lot easier in terms of bug-fixing and productivity. They also said Static Analysis which analyzes your code and tries to infer types and warns the developer in advance before the code even runs.
    They were overwhelmed by the amount of bugs found when they were converting their code to TypeScript.

  • According to Airbnb, TypeScript prevented 38% of the bugs based on their analysis.

TypeScript lets developers be productive and safe at the same time.

In StackOverflow's developer survey in 2020, TypeScript was declared to be the 2nd most loved programming language
TypeScript was used by 78% of the 2020 State of JS survey and 93% went on to say that they would use it again. It was also awarded the Most Adopted Technology based on year-to-year growth.

I hope I was able to share some knowledge through this post.

Thank you for reading

If you liked this post, subscribe to my newsletter to never miss out on my blogs, product launches, and tech news.

Abhiraj's Dev-letter

Top comments (2)

Collapse
 
crackineer profile image
Esam Olwan

Recently made the switch to Typescript in my latest project and the difference in finding bugs is huge. I like how accurate it is to find where is it that something is going wrong in your code without having to re-trace your code. Definitely a convenience.

Collapse
 
rammina profile image
Rammina

I really love Typescript! I like how it points out where the mistakes are on the editor without waiting for an error to show up on the browser. I like the safety that it gives and it also makes it easier for others to understand your code. IntelliSense is also really amazing.

However I don't think it is perfect and there are situations in which you don't want to use Typescript, so I discussed the downside of using it here:
dev.to/rammina/downsides-of-typesc...