Member-only story
Why I Migrated From JavaScript to TypeScript Again
The benefits of TypeScript and when you should migrate to it
JavaScript runs the web, people say. However, it’s also true that 39% of JavaScript developers hate it, according to the 2021 Stack Overflow survey and only 61% of them really want to work with it.
In 2012, while JavaScript was still king of web development, Microsoft released their new programming language, TypeScript. It was designed to make up for JavaScript when it comes to large, complex systems where its more flexible cousin would get the developers upset.
The survey also shows that a significant share of JavaScript developers wants to work with, or even switch to, TypeScript. The data shows that the latter is currently the third most loved programming language and 75% of its developers want to use it in 2022.
JavaScript in Complex Systems
A while back, I started working on a relational database management system (RDBMS) I wanted to implement from scratch. Even though I never was a fan of JavaScript, I still decided to write the system in it with Node.js because I wanted to learn more about this technology.
Initially, I was kind of satisfied with JavaScript’s dynamic typing system and extremely flexible structure. I could write code much faster than I would have in a language such as Java or C++, which would have been my first choice for such a project.
However, as the codebase was becoming always larger and increasingly complex, I started having frequent typing issues. I’m sure most of you know the frustration of receiving the “Cannot read properties of undefined/null” error message, but you have no clue where it might have originated.
Another struggle with JavaScript was working with objects. I always had to go back to where I created such objects, as there was no way of defining a strict template all instances must adhere to. To make it even worse, the IDE couldn't help with catching typos and, most importantly, it couldn’t give any hint about what methods and properties an object had. After all, the any
type doesn’t provide much information for both you and the IDE to work with.