Testing static types in TypeScript

[2022-11-28] dev, typescript

When it comes to TypeScript code:

  • There are many options for testing its behavior at runtime.
  • There are far fewer options for testing its compile-type types.

In this blog post, we look at the latter.

ECMAScript proposal: Array.fromAsync()

[2022-11-27] dev, javascript, es proposal

This blog post is about the ECMAScript proposal “Array.fromAsync for JavaScript” by J. S. Choi. It introduces a static method for converting asynchronous iterables to Arrays.

ECMAScript proposal: source text access for JSON.parse() and JSON.stringify()

[2022-11-18] dev, javascript, es proposal

In this blog post, we look at the ECMAScript proposal “JSON.parse source text access” by Richard Gibson and Mathias Bynens.

It gives access to source text to two kinds of callbacks:

  • Revivers, callbacks that are passed to JSON.parse() and post-process the data it parses.
  • Replacers, callbacks that are passed to JSON.stringify() and pre-process data before it is stringified.

We’ll examine how exactly that works and what you can do with this feature.

ECMAScript proposal: RegExp flag /v makes character classes and character class escapes more powerful

[2022-11-15] dev, javascript, es proposal

In this blog post, we look at the ECMAScript proposal “RegExp v flag with set notation + properties of strings” by Markus Scherer and Mathias Bynens.

Linking from GitHub to Mastodon

[2022-11-13] computers, decentralized, mastodon, github

Finding people on Mastodon is still difficult. If you have a GitHub account, you can help others find you by linking from it to your Mastodon account.


Getting started with Mastodon

[2022-10-28] computers, decentralized, mastodon

I use both Twitter and Mastodon and like both. Both have pros and cons.

In this blog post, I’d like to explain how to get started with Mastodon.

JavaScript metaprogramming with the 2022-03 decorators API

[2022-10-18] dev, javascript, es proposal

JavaScript decorators have finally reached stage 3! Their latest version is already supported by Babel and will soon be supported by TypeScript.

This blog post covers the 2022-03 version (stage 3) of the ECMAScript proposal “Decorators” by Daniel Ehrenberg and Chris Garrett.

A decorator is a keyword that starts with an @ symbol and can be put in front of classes and class members (such as methods). For example, @trace is a decorator:

class C {
  toString() {
    return 'C';

A decorator changes how the decorated construct works. In this case, every invocation of .toString() will be “traced” (arguments and result will be logged to the console). We’ll see how @trace is implemented later.

How to write CommonJS exports that can be name-imported from ESM

[2022-10-01] dev, javascript, nodejs

This blog post explores how to write CommonJS modules so that their exports can be name-imported from ESM modules on Node.js.


An overview of Node.js: architecture, APIs, event loop, concurrency

[2022-09-07] dev, javascript, nodejs

This blog post gives an overview of how Node.js works:

  • What its architecture looks like.
  • How its APIs are structured.
    • A few highlights of its global variables and built-in modules.
  • How it runs JavaScript in a single thread via an event loop.
  • Options for concurrent JavaScript on this platform.


Running cross-platform tasks via npm package scripts

[2022-08-31] dev, javascript, nodejs

The npm package manager lets us define small shell scripts for tasks and execute them via npm run. In this blog post, we explore how that works and how we can write them in a way that works across platforms (Unixes and Windows).