Is TypeScript good?
The Mere Exposure effect describes our tendency to develop preferences for things simply because we are familiar with them.
Perhaps you have a friend you didn’t like when you first met; you found it hard to be around them. But after being forced to spend time with them, for work or social reasons, you grew to like them. You can easily overlook the initial reasons you were irritated by them.
I have a friend like that. Maybe you know them? TypeScript. I really didn’t like it at first. Writing it felt slow and clunky, and I couldn’t see how it could benefit us as a team when 99% of the codebase was still JavaScript.
But I stuck with it, and kept plodding through, learning how to type our codebase. I’ve been working with it for over six months, and I’m growing to like it. I’m still unsure if TypeScript is preferable to JavaScript or just the exposure effect at play. Do I like it just because I’m familiar with it?
The part I like most is being able to “see what things are”. Now I get frustrated when I hover over a function or variable in VSCode, expecting it to tell me its types, and it can’t because it was imported from a JS file.
The part that makes me wary is how clever it makes me feel. TypeScript has major big brain energy. It tickles my brain in a way I’ve learned to be wary of because whenever I get too clever, I write code that is harder for others (or me, in 6 months) to read. There’s a real dopamine rush from successfully converting a gnarly JS file into a TS one, even though I’ve achieved basically nothing in reality. The product is doing the same thing.
So, my internal jury is still out on this one. I will proceed with caution.
Comments
Mark
November 13, 2023 at 9:49 PM
I also share some of the same thoughts on the topic.
TypeScript happens to have a few unfortunate drawbacks like no runtime type safety and more often than I care for it has an exceptionally awkward syntax precisely because it sits on top of a language that only knows dynamic typing and some of those gaps can be hard to close.
I’ve started to branch out of just “compiles to JS” languages a bit now that WASM garbage collection is landing it starts to open up a new set of languages and architecture options.
For what it’s worth I ended up landing on Dart as my new default language for most things these days and I have to say the difference in a language that was designed to have a proper type system from the ground up and what Typescript is able to deliver is two wildly different experiences.
Leave a Comment
💯 Thanks for submitting your comment! It will appear here after it has been approved.