Layanan
The issue
01 October 2023

Only, it doesn’t. As the red wavy line doesn’t reveal itself beneath the code, power courses through you. Authority. Confusion. To make things worse, not only does TypeScript not produce an error here, it actually tries being helpful, suggesting us to type test
, showing us its call signature, saying it comes from some TestApi
namespace. But that’s a type from Vitest, how can this be. . .
Would this code compile? Sure. Would it work in the browser? Nope. It will throw like a seasoned pitcher on his brightest day. How come? Isn’t the entire purpose of using TypeScript to guard against mistakes like this?