DEV Community

Cover image for I Chose TypeScript For the Nostalgia

I Chose TypeScript For the Nostalgia

Gerald Nash ⚡️ on June 21, 2017

Back when I was 13 years old and beginning my freshman year of high school, I wasn’t sure what programming language I wanted to learn first. After ...
Collapse
 
erebos-manannan profile image
Erebos Manannán

The best reason to use TypeScript is that IDEs can actually make writing TypeScript code a decent experience, and they really can't help much with JavaScript because of the ambiguity of everything.

Just try and find an IDE that can reliably do refactoring, auto-completion, inspections, etc. on JavaScript. For TypeScript that's almost trivial. TypeScript is really the way to make JavaScript into a manageable language to write quality software in, and I will likely never touch pure JavaScript again.

I've been using JavaScript in one form or another pretty heavily for a long time, and in many ways the ecosystem is just getting worse over time as people keep adding more and more tools to make working with the garbage language bareable. It's becoming more and more difficult to set up a working tool chain to work with, and because of the complex nature and constant re-inventing the wheel with those tools everyone else's example code is never compatible with your system as it's either built for some other tool chain or it's just built for older versions of the tools.

Just as a quick example how to manage the various steps in your no doubt fairly complicated build process: npm scripts, gulp, grunt, webpack, as well as tools built into IDEs and even Makefiles are all common options

Additionally since the language itself is really not very good for almost anything, and is missing so many things that would be considered "bare basics" in any decent language, you end up with a huge amount of dependencies of varying degrees of quality and with varying degrees of care put into their design and releases. This causes your code to unexpectedly break with updates (unless you use yarn) or just have unexpected behavior or performance characteristics in general.

Since it's not really reasonable to expect all browsers to start supporting another language, what I'm really hoping for myself is that one of those languages that compile into JavaScript (e.g. Kotlin) or maybe some Emscripten -powered thing sets up a great ecosystem and takes over so we can get past this giant mess that JavaScript is right now. While that is not the case, TypeScript is definitely a step to the right direction and reduces the need for some of those tools, and makes you much more productive.

By the way, on the point of although TypeScript’s typing is more of a recommendation, you should configure your tsconfig.json to not make it a "recommendation" but to make it a requirement.

Collapse
 
ben profile image
Ben Halpern

Very honest and well-articulated account of the kind of process we all go through when navigating technology choices. A lot of devs will come up with really complicated explanations about using words like idempotency as if development is a stateless activity that has nothing to do with our prior experiences and the tastes we've built up over time.

I've heard people build up impassioned "logical" arguments for their defense of a certain tech or pattern, when they're really just expressing a reaction to their singular experience with the technology that fails to account for the million things that could have affected their experience.

I feel like this post is a more honest introspection of choices than I typically see. Great stuff, Gerald.

Collapse
 
joeybuczek profile image
Joey Buczek • Edited

I recently started adopting TypeScript for my JavaScript projects at work, and I've found that it's been a truly useful tool for all the reasons you've mentioned above.

Great read!