Conditional overloads that work when conditional types fail

TypeScript
  • 1.4k words
  • 8 mins

How can we define methods that have different signatures depending on a type parameter?

Let’s take a look!

read more

Exposing utility types

TypeScript
  • 900 words
  • 5 mins

What do you do when you have a bunch of utility types that are closely related to a class or interface? Should you expose them or not?

read more

Fixing type inference in generic rest parameters

TypeScript
  • 700 words
  • 4 mins

It turns out that combining generics with rest arguments is kind of tricky in TypeScript. Let’s see where the normal approach fails and how we can use tuples to fix it!

read more

Treating types as values with type-level maps

TypeScript
  • 1.6k words
  • 8 mins

With a shift in perspective, we can view complex type declarations as another kind of code. Code where types are values.

There’s no better example of this than the type-level map. Let’s take a closer look!

read more