Skip to main content

Future-proof union values handling with TypeScript

· 7 min read

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.

Early abstraction meme

The 5 commandments of clean error handling in TypeScript

· 11 min read
Marvin Roger
Senior Software Engineer
Cover

Dealing with errors is an essential part of software engineering.

Defining and having strong guidelines on how to handle errors will make your life easier when developing features, but also, and maybe more importantly when things go wrong!

At Orus (where we try to reinvent professional insurance), over time, we tailored an error strategy that works well for us and that we think could be useful to share.