When we code, we tend to focus on the “happy path”. Yet in the real world, there is validation, logging, network errors, and other “unhappy paths”.
The good news is that we know about these different paths. We know that validations may fail, and we know that network requests may not come back. Railway-oriented programming is an approach that makes sure we think about and handle all these possible outcomes. Some languages regularly benefit from it; now, it’s time for TypeScript.