Writing unit tests with Cursor IDE
I created a “view model” like hook in React, and asked Cursor to write unit tests for it. The hook does not have any HTML code, but it uses a […]
I created a “view model” like hook in React, and asked Cursor to write unit tests for it. The hook does not have any HTML code, but it uses a […]
Typescript allows a type to reference another type defined further down in the same file, which can lead to rather interesting constructs. The vanilla circular reference fails: However, the following […]
I stumbled upon the following code in production: This sort of does the job, but any is a fruit of a poisonous tree: it should have had a much more […]
In TypeScript (and JavaScript), both substr and substring are methods used to extract parts of a string, but they behave differently. This probably does not beat standard C++ class mt19937, […]
TypeScript allows passing class methods to functions that expect a lambda, but it won’t work at runtime. Consider this code: Suppose we have class Calculator like this: We can then […]