Implementing a Maybe Pattern using a TypeScript Type Guard
Taking inspiration from the Maybe monad to enforce run-time null-safety while coding in TypeScript.
You’re sat at a restaurant, and you order a beer. The waiter disappears into the kitchen, and returns a couple of minutes later, empty-handed. “I’m sorry,” he says. “I could not get your beer.”