Building type utils to derive interfaces from unions of interfaces in TypeScript

Generics we're going to build to derive types from other types
In this post, we're going to build small, generic type utils in TypeScript, and we'll do that by refactoring code from real world example.

We're going to pick an approach leveraging template literals, and type inference to provide a nice developer experience.

Deriving types from other types in TypeScript — unions and interfaces

Union type to interface transition
The transition from union type to interface, and back
Maintaining a lot of similar types can be a mundane task, especially if some of them must stay in sync due to some dependency on one another.

You're going to learn how to, with a little bit of type-level programming, reduce that toil by deriving types from other types.

Union types, pattern matching and exhaustiveness in today's JavaScript

Despite being a small library, there is a lot we can do with daggy
Pattern matching and union types are, in my view, one of the concepts in programming which don't get the attention they deserve. In this post, I'm going to show how they can help us write more declarative code.

Leaving implementation details for later with unsafeCrashWith in PureScript

Once we're happy with the overall design of our code, all that is left is the actual implementation
Focusing on implementation details might be a waste of time if we just want to test an idea out. In these rare cases, the unsafeCrashWith function defined in the Partial.Unsafe module comes in handy

Pattern match multiple values without a Tuple in PureScript

We can pattern match multiple values with no extra imports, natively
To pattern match multiple values in PureScript, it's very tempting to wrap them with Tuple data constructor. That's not really necessary.