by jshxr · 1y ago · 0 comments
type UserID = string & { readonly __tag: unique symbol }
which always feels a bit hacky.I think it's a much better idea to do:
type UserID = { readonly __tag: unique symbol }
Now clients of `UserID` no longer knows anything about the representation. Like with the original approach you need a bit of casting, but that can be neatly encapsulated as it would be in the original approach anyway.