• 2024-04-07 21:56

    Understanding Relay Data IDs

    When I started using the Relay framework, I wasn't really sure what I was looking at inside the dev tools. Relay dev tools … Read more
  • 2023-05-11 21:00

    Exhaustive switch statements in Typescript

    I was looking for a way to exhaustively type-check switch statements when writing Typescript. I went through few iterations with a colleague at work before we arrived at something that worked. The goal is to always cover all possible cases using case, similarly how language such as Rust forces you to return value as Option<...>. Note: All code examples were tested on Typescript v5.1.6 Imagine the following example code: type Id = "A" | "B" | "C"; function getId(id: Id) { switch (id) { case … Read more