Maturity is when you realize the true powers of TypeScript

Author pic

Written By - Garvit Maloo

23 August, 2023

In this blog, I have shared my experience with TypeScript. Although JavaScript is not my first programming language but I am absolutely certain that it's my first love. And trust me, TypeScript truly accentuates the beauty of JavaScript.

I have been into JavaScript development since almost 2 years now. I have been ignoring TypeScript for more than 1 year. Even after watching videos of experts talking about the importance of TypeScript in modern projects and organizations, I didn't realise the importance of TypeScript until I was assigned my first task in my first company back in November 2022. I was clueless about what to do with the code that was there in front of me. I was just a beginner in backend development with NodeJS and I was assigned to make an API that could upload a resource to AWS S3, make an entry in DB and return an appropriate response to frontend. The project architecture was beyond my wildest dreams and to worsen the problems, it was written in TypeScript. So, I started learning TypeScript from its official documentation, playing around on some online coding playgrounds and somehow, I managed to write code that could upload files on AWS S3. But, the code was nowhere near ready to be reviewed by seniors and managers and things didn't workout over there. So, this was my first experience with TypeScript. Definitely not so good.

But this was certainly an eye-opening experience for me. I immediately decided to work more on TypeScript skills and today, I can confidently say that I am pretty good with TypeScript. We go along really well and I love working with TypeScript. The full stack project that I am working on right now uses TypeScript.

So if you are new to JavaScript and if you are not yet working in any company/start-up, I highly recommend you to please learn TypeScript. Most likely they will also be using TypeScript. Forget about company or industry standards, trust me if you like working with JavaScript, you will love TypeScript, maybe after a certain point of time, but you will definitely love it once you start understanding it.

TypeScript is simply a layer on top of JavaScript. JavaScript is a weakly-typed language. We need not to specify the variable type or what type of value a function will return. This makes JavaScript easy to learn for beginners but as you grow as a JavaScript developer and work on more advanced projects, it starts to become a setback. The weakly-typed nature of JavaScript in such big projects could very easily lead to bugs and issues and create problem for a team of developers working together on the project.

TypeScript solves this problem really well. It gives a well-defined shape to our project and we can say that it enforces certain rules in the codebase. Like when we define a variable that must be of the type Number, no one can assign a string to that variable. Here's an example -

const num: Number = 10 // valid
const num: Number = '10' // TypeScript will not allow this.

So basically TypeScript introduces type checking in JavaScript which reduces probability of bugs and errors.

Besides type checking, TypeScript brings with itself an array of useful features which do not exist in JavaScript. With TypeScript, we can make use of interfaces, abstract classes, enums, index signatures and a couple of other useful features too which do not have an in-built support in JavaScript. TypeScript really enhances developer experience, especially when we are working with Object Oriented Programming projects in JavaScript. Although I admit that Java is the best language for Object Oriented Programming according to me, but because JavaScript is my first love, I have always been inclined towards it and now that I understand TypeScript, it is even more fun working on OOP projects in TypeScript.

So moral of the story is TypeScript is super useful and fun. So if you are looking for getting a job in a good startup or development agency, please make sure that you are familiar with TypeScript. It is not difficult to learn but it definitely needs some practice. So try making some projects with TypeScript.

Also, if this blog convinces you to learn TypeScript, make sure that you also read my blog on learning a new framework/library. This might give you some insights on how to learn something new in programming. Hope this blog helped you get some insights. See you soon in a next blog 🙋

Liked the content? Share it with your friends!
Share on LinkedIn
Share on WhatsApp
Share on Telegram

Related Posts

See All