Hacker News new | ask | show | jobs
by renke1 1735 days ago
I've build a library to do that (based on various known techniques) in [1]; it's also combined with validation based on zod. I would say it's usable but of course having true nominal type support in TypeScript would be way better.

For complex types it also disallows spreading to prevent circumventing validation. However, errors are often not has human readable as one would like them to be.

[1]: https://github.com/renke/vo/tree/master/packages/vod