The ECMAScript proposal “Class static initialization blocks” by Ron Buckton is at stage 4 and scheduled to be included in ECMAScript 2022.
For setting up an instance of a class, we have two constructs in JavaScript:
For setting up the static part of a class, we only have static fields. The ECMAScript proposal introduces static initialization blocks for classes, which, roughly, are to static classes what constructors are to instances.
Iteration is a standard that connects operations with data containers: Each operation that follows this standard, can be applied to each data container that implements this standard.
In this blog post:
.map()
, .filter()
, and .forEach()
.A monorepo is a single repository that is used to manage multiple projects. In this blog post, we’ll explore how to set up a simple monorepo for two npm packages. All we need is already built into npm and TypeScript.
In this blog post, I’ll explain everything you need to know in order to use and produce native ECMAScript modules on Node.js.
The GitHub repository iterable
is an example of a TypeScript ESM package that works on Node.js. It still uses the "typesVersions"
workaround (which isn’t needed in TypeScript 4.7 and later).
Date
, JavaScript’s current date time API is infamously difficult to use. The ECMAScript proposal “Temporal” is a new and better date time API and currently at stage 3. It was created by Philipp Dunkel, Maggie Johnson-Pint, Matt Johnson-Pint, Brian Terlson, Shane Carr, Ujjwal Sharma, Philip Chimento, Jason Williams, and Justin Grant.
This blog post has two goals:
However, it is not an exhaustive documentation: For many details, you will have to consult the (excellent) documentation for Temporal.
Warning: These are my first explorations of this API – feedback welcome!
In this blog post, we examine the ECMAScript proposal “Ergonomic brand checks for private fields” (by Jordan Harband). It proposes a compact way for checking if an object has a given private field.
Object.prototype.hasOwnProperty()
In this blog post, we examine the ECMAScript proposal “Accessible Object.prototype.hasOwnProperty()
” (by Jamie Kyle and Tierney Cyren). It proposes a new, simpler way of checking if an object has an own (non-inherited) property.
In this blog post, we examine the ECMAScript proposal “JSON modules” (by Sven Sauleau, Daniel Ehrenberg, Myles Borins, and Dan Clark). It lets us import JSON data as if it were an ECMAScript module.
In this blog post, we examine the ECMAScript proposal “Error cause” (by Chengzhong Wu and Hemanth HM). It describes a feature where instances of Error
can optionally specify that they were caused by another error.
undefined
vs. null
revisitedMany programming languages have one “non-value” called null
. It indicates that a variable does not currently point to an object – for example, when it hasn’t been initialized yet.
In contrast, JavaScript has two such non-values: undefined
and null
. In this blog post, we examine how they differ and how to best use or avoid them.