@colinhacks ("Colin McDonnell") wrote:
As a +1 to this excellent thread:
the ability to build APIs that return a discriminated union (ADT) is one of the killer features of tRPC. plus the union type itself is implicit - inferrable from any function with 2+ return statements. 🔥typescript!🔥
with quote tweet:
@JasonKuhrt ("Jason Kuhrt") wrote:
As I've matured as a developer I've noticed how increasingly one of the early stage things I do when refactoring existing or introducing new code is ask "How can the data structures encode the invariants?". The fewer branches of downstream logic possible the far better, I find.🧵