Friendly Little Wrapper Types — Sympolymathesy, by Chris Krycho
v5.chriskrycho.com·2h
📘TypeScript
Preview
Report Post

Assumed audience: Software developers. Assumes basic knowledge of wrapper types and uses some Domain-Driven Design concepts; discusses about software services and assumes a fair bit about large systems. You’ll follow along fine without knowing much about either, though, as long as you know some basics of software.

A while back I was having a friendly debate with a colleague about whether there’s value in providing an opaque “wrapper” type around things like identifiers — a user ID, for example — in a service that doesn’t treat those as a core concern.

What I mean by an opaque wrapper type is something like this in TypeScript:

class UserId {
#value: string;

co...

Similar Posts

Loading similar posts...