Notes

Short notes about anything that catches my attention. Also a place to save stuff I keep forgetting over and over.

08/01/2026

18:49

Exhaustiveness checking:

type Shape = Circle | Square;
 
function getArea(shape: Shape) {
  switch (shape.kind) {
    case "circle":
      return Math.PI * shape.radius ** 2;
    case "square":
      return shape.sideLength ** 2;
    default: {
      const exhaustiveCheck: never = shape;
      return exhaustiveCheck;
    }
  }
}

10/14/2025

11:07

Typecasting is evil.

03/05/2025

16:33

If you want to represent an empty object, use Record<string, never>.

This is a hand-crafted, a little weird personal website. Create one of your own!