Does TypeScript worth learning? My expirience

Does TypeScript worth learning? My expirience

Several months ago, I was doubtful about learning TypeScript. It seemed to be unnecessarily complicated for use with React and Node.js. I thought it would slow down my codding. But for some reason, Top Tech Companie still requires expirience in TypeScript.

Then I learned it and ended up developing my first Market Place Web app with React, Node.js, and TypeScript.

You, as a developer, can be wondering whether TypeScript worth your time and effort. I certainly was. I want to share my expirience in learning and using TypeScript to help you make your own decision.

Why I hesitated about learning TypeScript

If you don't know whether you need to learn TypeScript or not, you are not alone. I saw many developers who have the same question. Learning requires a time commitment and takin the risk of starting a new project with this language.

My main fear of using TypeScript was that it would slow down my development. I thought it could be an overkill for React projects and Node.js, and it is only suitable for Enterprise level Projects.

Back then, I understood the benefits of strictly typed language, but I loved how fast I can develop something with JS without thinking about typings.

Why I decided to learn TypeScript

I got serious about the idea of learning TypeScript after I finished my first FullStack web App on React/Next.js and Node.js. Development of the first Full-stack Web Application gave me a clear understanding that I should do something about code quality.

Even though I loved the speed of development and flexibility of JS, in most cases, it was too flexible.

In the past, I worked with C++ and C#, where the application has strict and predictable architecture. While with JS, I can write any shitty code and don't follow any structure, and it will work. Because of this, usually, JS projects was difficult to support and develop new features.

I had two weeks before the start of the next Full Stack project, which promised to be way more significant than the previous one. So I decided to spend a gap of two weeks on learning TypeScript. I had a feeling that the next project will turn into hell unless I use TypeScript to enforce more structure. I needed a compiler yelling on me when I write a shitty code :)

Other than that, I also saw an opportunity in the freelance/job market. Developers who know TypeScrip usually have a higher demand than the ones who don't. This reason also added up to my decision to learn TS.

How I learned it

Learning TypeScript wasn't tricky. My expirience with C++ and C# helped me a lot. I just bought a course on Udemy and watched about 60% of it.

Then when the time came to start the next freelance project, I began development with TypeScript. I was fully confident in my abilities when starting codding. (Even though I haven't practical expirience before :))

Most of my learning happened by doing. And I think it was the fastest way to do it. TypeScript compilator is an excellent teacher. He will always point out your mistakes. And google will help you find the answers :)

My first day with TypeScript

The first day with TypeScript was quite memorable since I jumped in the development without practical expirience.

The day was full of stress and disappointment. Every task that I used to do seemed twice as slow and complicated. I could not yet see any benefits of the TypeScript. My development console was always filling with a bunch of compilation errors.

I even was thinking that I made a mistake by choosing TypeScript.

Yet, I still decided to stick with it for a couple more days and see how it will go. I had the hope that I will get better at TS and start to see the advantages of it.

Falling in love with TypeScript

As I continued working with TypeScript, my attitude gradually changed. The more I worked with it, the faster I started to write code. Soon I had far fewer compilation errors waiting for me in my console. Within several days everything returned to normal. I was writing with TypeScript as effortless as with JavaScript.

The bigger got the project, the more benefits of the TypeScript I started to notice. The project shouldn't be necessary as big as you think to grip the benefits of TS. Just a week of codding one codebase, and you begin to appreciate that you have TypeScript. Some tasks become easier and faster to do; then, it was before on plain js.

What I like the most about TypeScript

The first thing I noticed when coding React App with TypeScript is native support of the component propTypes. Prop typings saves a bunch of time and helps make code more reliable.

When you define props for your React Component, you get an awesome IntelliSense and autocompletion. So there is no need to remember the props component uses.

Typing for the props makes components more encapsulated and reusable. The compiler will always tell you when you use your React Component in the wrong way.

Also, Typed React Components helps reduce the number of props you use. There is no need now to write props like:

Loading...

With TS, you can define a type of User and then make a component with a prop of this type. Then you don't need to wonder what properties should User Objects have. TypeScript will make sure that everything is in place.

Loading...

Generally, Inteleses is the most significant thing that improved my development expirience. There is no need to guess what arguments function takes or what properties an object has. Especially when your project grows, and code of the app split all over the files and folders.

TypeScript helps you to avoid errors during runtime and avoid unpredictable situations for users. It forces me to handle situations in code, which I usually tend to skip when writing with JS.

For example, if the compiler sees that the variable can have the value undefined, it will force you to make sure that you won't use it in your code in this case.

And another great plus in typescript is that it enforces code structure in the application. It makes team collaboration easier. Any team member can effortlessly see how he can use function or component without necessarily exploring the code of it.

The compiler will always warn anyone who will use the component or function in the wrong way.

Takeaways. Does TypeScript worth learning?

For me, TypeScript gives me far more benefits than disadvantages. I will continue using it in my projects. It is an excellent tool for increasing code quality and making collaboration easier. Higher code quality makes it easier to add new features to applications and reduces time spent on bug fixing.

If you are hesitating about learning TypeScript, consider some of the benefits it can give you:

  • Higher demand for TypeScript developers on the job market
  • Better development expirience
  • Writing higher-quality code

Remind you before jumping into TypeScript; you need to have a solid understanding of JavaScript. Or if you have experience with strictly typed languages learning TypeScript will be like a walk in the park for you.

Be prepared to have difficulties in the first couple of days, but then everything will get to its norm. You will enjoy the benefits TypeScripts gives to you.

---

Thanks for reading! :)

I am Vova Pilipchatin, a freelance Software Engineer and Web Developer.

If you are enjoyed this article, please follow me on Twitter.

There I share what I learn about developing web apps, launching SaaS projects and building a freelance business :)

Get posts on Building SaaS and Interent-Powered Buissness right in your inbox

JourneyLessons and stories from my entrepreneurial journey
AdviceAdvices, stories and interviews from SaaS Founders and Marketers