Future-proof union values handling with TypeScript
Unions and discriminated unions are great tools that can make the code flexible, while keeping the complexity to a low level. But tiny differences in the style of the code that uses them can make the difference between robust code, and bugs waiting to happen.
In this article, we will dive into two patterns that can help us make our code more future-proof.
But before "future-proofing" our code, let's remember that many technical debt nightmares originate from unfortunate attempts to be future-proof.
So let's be clear about what we mean by future-proof code.
