TypeScript is the new hot trend of this year 2021, and is expected to grow even more during the next few years, along with some other technologies such as NextJS, GraphQL and others, and for good reasons too. The type safety that it offers, the IntelliSense, as well as some traditional object-oriented-programming concepts such as Interfaces, and access modifiers, has upped the game for JavaScript developers big time, and made JavaScript all the more robust and safe, while adhering to the same rules that governs it (ie: any valid TypeScript code, is a valid JavaScript code).
With that in mind, I have finally made the switch about 7 months ago. This switch has started a journey full of ups and downs, and frustrations at the beginning. But the end result was so worth it, and I can safely say now that I have no intentions to return to regular JavaScript ever again.
What to expect?
The first few weeks, TypeScript coding felt like walking in a minefield. I had to watch out for every variable I write, and its type, lest I get bombed with humongous lines describing an error somewhere. And they are everywhere.
Before, when working with React, all I had to do was to install some dependencies, and get get going. But now, I need type definition for each one, that is, if they are not made separately in a different NPM package all together.
I also got frustrated every time I had to bypass an error that I wouldn't have got if I used JavaScript instead (if I had a coin each time I said to myself "let me just switch back JavaScript, it'll make this smooth again", I'd have a lot of coins).
But I know I had to persist, because I knew what benefits I'll gain in the end. And I did, both persisted and gained advantages. The errors don't appear that much anymore, and if they do, they are predictable, and significantly easier to deal with than before.
I now write safe, consistent code, and I get warned beforehand, at compile time, of errors, instead on seeing them on the app screen on the browsers, or the console. So peace of mind it is.
In conclusion, I do recommend trying TypeScript at least, because it's worth the relative troubles, and it'll make your coding experience far more enjoyable in the long run.
Connect with me on:
Top comments (1)
Typescript doesn't make sense
Typescript doesn’t make sense (medium.com/@desphilboy/why-typescr...)