The #JavaScript testing framework #jest somehow breaks built-in classes so that `x instanceof Error` always gives false. (Same for Array.) This completely breaks error handling when running tests! `Error.isError(x)` seems to work, but #TypeScript doesn't know about it (for NodeJS 24 LTS, even though it has that method)! I'm hack-fixing it with this TypeScript declaration:

Note: Only use `Error.isError()` if you're on NodeJS >= 24.3. While 24.2 already has that method it doesn't work for all exceptions (DOMException in particular)! Works for any exception in >= 24.3.

(Also Safari (the new Internet Explorer) doesn't have it, but I'm only talking in the context of NodeJS here anyway.)

JavaScript execution model - JavaScript | MDN

This page introduces the basic infrastructure of the JavaScript runtime environment. The model is largely theoretical and abstract, without any platform-specific or implementation-specific details. Modern JavaScript engines heavily optimize the described semantics.

MDN Web Docs
@nicofrand Of course it is. But doesn't matter. It totally destroys error handling and is just insane that I have to work around the testing framework!