I started the Effective TypeScript blog on March 6, 2020. It was my fourth day staying home from work with a lingering illness. I had no idea that ten months later, I'd still be working remotely. It's been quite a year.
I wrote 17 blog posts in 2020, very close to my goal of a post every two weeks. Here were the most popular:
The Golden Rule of Generics (August 12th)
My most popular post is based on advice in the TypeScript handbook. The alternate title was "Good use of generics or bad use of generics?" This showcasing of good examples and bad examples made this article fun to write and, evidently, fun to read as well. The extensive discussion on r/programming is worth reading. I'm intrigued by the idea of introducing generic parameters as a way of simulating nominal types to help get a function's implementation correct.
I was quite happy when I "discovered" this trick, only to learn a few months later that I'd subconsciously cribbed it from Anders Hejlsberg's excellent tsconf 2018 keynote. Whatever the provenance, I've soured on tools like
Jsonify. Better to unify types instead of modeling small differences. Look for a future post on this topic. Also notable on this was the wildly different response on r/typescript vs. r/programming.
Item 54: Know How to Iterate Over Objects (May 26th)
TypeScript Splits the Atom (November 5th)
Template Literal Types are one of the most exciting additions to TypeScript in years, and we're all just starting to learn how to use them. This post introduces them to an audience that may not be familiar with TypeScript and explains why I think they're a particularly TypeScripty solution to a long-standing class of issues. See discussion on r/programming.
Unionize and Objectify (May 12th)
This article was inspired by a particularly insightful answer from Titian Cernicova Dragomir on Stack Overflow. I kept finding more uses for his trick, and I wanted to give it a catchy name.
Unionizeit is! I'm quite proud of this post and I'm happy to see it crack the top five.
I'm excited to see what 2021 brings to TypeScript! I've started a series on generics that I plan to wrap up this month. I'm working on "Pet Peeves in TypeScript Writing" post, and am planning some kind of (now late) "Writing a book, the view from a year out" retrospective. Subscribe or follow for updates!