Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I find that for most of my use cases, branded types[1] are close enough to nominal (especially if you use a private `unique symbol` as the brand).

[1]: https://www.learningtypescript.com/articles/branded-types



I did say easy and by that I also meant lightweight. You can just use a string not an object with a relatively esoteric symbol in addition to whatever serializable value you need.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: