Just added: Embedded C From Zero
TypeScript
type Shape =
  | { kind: "circle"; radius: number }
  | { kind: "rect"; width: number; height: number };

function area(s: Shape): number {
  // switch on s.kind: "circle" -> Math.PI * radius squared, "rect" -> width * height
  return 0;
}

const circleArea = area({ kind: "circle", radius: 2 });
const rectArea = area({ kind: "rect", width: 3, height: 4 });