Top Posts of 2020

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:

  1. 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.

  2. What's the type of JSON.parse(​JSON.stringify(x))? (April 9th)

    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.

  3. Item 54: Know How to Iterate Over Objects (May 26th)

    The blog started with several sample items from Effective TypeScript and this one has done well with Google: "Iterating over the keys and values in an object is a common operation that's surprisingly hard to write without type assertions in TypeScript. The difficulty results from a combination of the quirks of JavaScript objects and duck typing."

  4. 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.

  5. 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. Unionize it 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!

Like this post? Consider subscribing to my newsletter, the RSS feed, or following me on Twitter.
comments powered by Disqus
Effective TypeScript Book Cover

Effective TypeScript shows you not just how to use TypeScript but how to use it well. The book's 62 items help you build mental models of how TypeScript and its ecosystem work, make you aware of pitfalls and traps to avoid, and guide you toward using TypeScript’s many capabilities in the most effective ways possible. Regardless of your level of TypeScript experience, you can learn something from this book.

After reading Effective TypeScript, your relationship with the type system will be the most productive it's ever been! Learn more »