I am thinking that I regret not using TypeScript earlier. Before, I would think that TypeScript was a nice tool, but not completely necessary. My attitude was completely relaxed towards TypeScript. I have been programming in Vanilla JavaScript for a long time, so I reasoned that I didn’t need to use the features that TypeScript offered. I could keep track of data types easily! A number is a number, and a string is a string. If a number is concatenated with a string, that will probably not output what you want. Or if you try to have a short circuited conditional with numbers, you might remember about the falsey zero value will stop the short circuited conditional. I knew about the quirks that came with JavaScript.
I currently use TypeScript with my job. My exposure to TypeScript has changed; I use TypeScript on a regular basis! And my constant exposure to TypeScript is changing my attitude about it. While I still think that TypeScript is a nice tool and not completely necessary, I do realize it is a great tool. If I look at my shelf of web development tools, I will definitely reach for TypeScript first now.
TypeScript rocks! Let me show one reason why.
TypeScript gives the opportunity to map paths that look like NPM modules to relative paths in the project.
Lets say I have a local module in my project at src/app/mylocalmodule
. I can go into the tsconfig.json
file and specify an NPM-like path! So now anywhere else in my TypeScript project, I can refer to @ag/mylocalmodule
instead of some relative path! The example relative path ../../../app/mylocalmodule
can now just change to @ag/mylocalmodule
. That’s fantastic! It saves trying to mentally map where things are relative to the current working directory.
I’ll keep using TypeScript. It is a great tool that I am excited to use. It can save so much mental mapping and awareness for me so that I can focus on the actual programming aspect instead of bugs. I have a programming relative that could say, “Ha! I told you so!” And yep, he was right. And he’ll probably read this too. I like using TypeScript and I guess any programming language that has a strict type system! There are a few Rust things that I have done! TypeScript is a great tool to help me be a better programmer.