Updated

Typescript

Having come from programming in C# using design principles and well-structured, strongly-typed, and component-based patterns, I found Javascript to be particularly frustrating. The fact that you could assign a variable a string and then later set it to a number horrified me. I hadn't even programmed much more than a basic document query and I already deeply missed my interfaces, generics, and class scoping - not to mention the amazing intellisense, autocompletion, and code suggestions provided by the Jetbrains Rider IDE.


Enter Typescript - a solution to most of the issues I had with Javascript. I could now type my JS objects, and work with them safely knowing that any syntax errors or basic typos would flash a warning at me sometime before I tried to test it. Additionally, I now get some intellisense based on the types I'm working with, and that makes the development process much easier - even if there is a bit more setup involved anytime I want to do something simple like declare props for a React component (mainly because I always intentionally set the "no implicit any" option to true). I can also use design patterns again - my favorite design pattern resource, Refactoring Guru, even has examples specifically for Typescript (but not for vanilla JS, go figure).
I learned most of what I know about Typescript from the Typescript: The Complete Developer's Guide Udemy course by Stephen Grider, and from the Youtube series No BS TS by Jack Herrinton. Both resources have been excellent and I highly recommend them to anyone looking to learn Typescript.


I do understand sometimes why Javascript is so loosely typed and why some developers like it that way - specifically when working with external APIs and converting back and forth between JSON and Javascript. It feels a bit tedious to have to work up a type interface for every React component prop or external API call, and I often don't have all the type information, such as which fields can potentially be null. However, it always pays off in the end by enabling the use of design patterns, providing intellisense, and saving hours of debugging caused by simple typos.