A typed introduction to JavaScript, I mean Typescript

If you are a Javascript developer, you must have heard about Typescript at one point or another. If you have been reluctant about giving Typescript a try because you are not sure how it could serve you better than Javascript, you have come to the right place.

This guide gives an introductory but comprehensive guide to Typescript any Javascript developer would need to get started with it.

What is Typescript, what is its type system, and how would it benefit you as a Javascript developer to use Typescript in your next project? You will find answers to all these questions by the end of this article.

Note: I may be a bit biased towards Typescript. There’s no project that I start where I prefer JS over Typescript.


What is Typescript?

You can think of Typescript as a language that provides an additional layer over Javascript.

Why?

Although we initially write our code in Typescript, we can’t directly run Typescript on a browser like we run Javascript. Instead, Typescript goes through an additional compilation step to convert its code into browser-recognized Javascript.

So, even when we program in Typescript, the end-program that runs on the browser will be in Javascript.

Then, why do we use Typescript at all?

Though Typescript doesn’t provide additional functionalities than Javascript at runtime, it offers a set of features to ensure that we, the developers, can write less error-prone and better maintainable code compared to when using just Javascript.

#typescript #javascript #developers

What, Why, and How of Typescript for JavaScript Developers
1.35 GEEK