2025-03

Unions and intersections of object types in TypeScript

[2025-03-04] dev, typescript

In this blog post, we explore what unions and intersections of object types can be used for in TypeScript.

My sales pitch for TypeScript

[2025-03-02] dev, typescript

Roughly, TypeScript is JavaScript plus type information. The latter is removed before TypeScript code is executed by JavaScript engines. Therefore, writing and deploying TypeScript is more work. Is that added work worth it? In this blog post, I’m going to argue that yes, it is. Read it if you are skeptical about TypeScript but interested in giving it a chance.

2025-02

What is TypeScript? An overview for JavaScript programmers

[2025-02-27] dev, typescript

Read this blog post if you are a JavaScript programmer and want to get a rough idea of what using TypeScript is like (think first step before learning more details). You’ll get answers to the following questions:

  • How is TypeScript code different from JavaScript code?
  • How is TypeScript code run?
  • How does TypeScript help during editing in an IDE?
  • Etc.

Note: This blog post does not explain why TypeScript is useful. If you want to know more about that, you can read my TypeScript sales pitch.

Simple TypeScript playgrounds via node --watch

[2025-02-25] dev, typescript

Now that Node.js has built-in support for TypeScript, we can use it as the foundation of simple playgrounds that let us interactively explore TypeScript code.

Testing types in TypeScript

[2025-02-24] dev, typescript

In this blog post, we explore how we can test that complicated TypeScript types work as expected. To do that, we need assertions at the type level and other tools.

The unexpected way in which conditional types constrain type variables in TypeScript

[2025-02-23] dev, typescript

The TypeScript handbook makes an interesting statement: “Often, the checks in a conditional type will provide us with some new information. Just like narrowing with type guards can give us a more specific type, the true branch of a conditional type will further constrain generics by the type we check against.”

In this blog post, we’ll see that this goes further than you may think.

Demo: implementing a Node.js CLI app directly in TypeScript

[2025-02-20] dev, typescript

I have published the repository nodejs-type-stripping which demonstrates how to implement a package with a bin script that is written directly in TypeScript (no transpilation).

The bottom type never in TypeScript

[2025-02-19] dev, typescript

In this blog post, we look at the special TypeScript type never which, roughly, is the type of things that never happen. As we’ll see, it has a surprising number of applications.

Array type notations: T[] vs. Array<T> in TypeScript

[2025-02-17] dev, typescript

In this blog post, we explore two equivalent notations for Arrays in TypeScript: T[] and Array<T>. I prefer the latter and will explain why.

Symbols in TypeScript

[2025-02-17] dev, typescript

In this blog post, we examine how TypeScript handles JavaScript symbols at the type level.

If you want to refresh your knowledge of JavaScript symbols, you can check out chapter “Symbols” of “Exploring JavaScript”.