2025-06

TypeScript: checking Map keys and Array indices

[2025-06-21] dev, typescript

JavaScript has two common patterns:

  • Maps: We check the existence of a key via .has() before retrieving the associated value via .get().
  • Arrays: We check the length of an Array before performing an indexed access.

These patterns don’t work as well in TypeScript. This blog post explains why and presents alternatives.

How TypeScript solved its global Iterator name clash

[2025-06-18] dev, typescript

In ECMAScript 2025, JavaScript gets a class Iterator with iterator helper methods. This class conflicts with TypeScript’s existing types for iterators. In this blog post, we explore why that is and how TypeScript solves that conflict.

2025-05

Styling console text in Node.js

[2025-05-15] dev, javascript, nodejs

In this blog post, we explore how we can style text that we log to the console in Node.js.

Some of the examples use a Unix shell but most of the code should also work on Windows.

2025-04

Converting values to strings in JavaScript has pitfalls

[2025-04-29] dev, javascript

Converting values to strings in JavaScript is more complicated than it might seem:

  • Most approaches have values they can’t handle.
  • We don’t always see all of the data.

Deploying TypeScript: recent advances and possible future directions

[2025-04-13] dev, typescript

In this blog post we look at:

  • The current best practice for deploying library packages: .js, .js.map, .d.ts, .d.ts.map, .ts
  • Recent new developments in compiling and deploying TypeScript: type stripping, isolated declarations, JSR, etc.
  • What the future of deploying TypeScript might look like: type stripping in browsers, etc.

Ideas for making TypeScript better at testing types

[2025-04-12] dev, typescript

In this blog post, we examine how we can test types in TypeScript:

  • First, we look at the library asserttt and the CLI tool ts-expect-error.
  • Then, we consider which functionality could be built into TypeScript.

2025-03

Could JavaScript have synchronous await?

[2025-03-28] dev, javascript

In JavaScript, code has color: It is either synchronous or asynchronous. In this blog post, we explore:

  • The problems caused by that
  • How to fix them via synchronous await
  • The two downsides that prevent synchronous await from being practical

A closer look at the details behind the Go port of the TypeScript compiler

[2025-03-11] dev, typescript

Today’s announcement by Microsoft:

[...] we’ve begun work on a native port of the TypeScript compiler and tools. The native implementation will drastically improve editor startup, reduce most build times by 10×, and substantially reduce memory usage.

This blog post looks at some of the details behind the news.

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.