Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
matt_kantor
6 months ago
|
parent
|
context
|
favorite
| on:
Run TypeScript code without worrying about configu...
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
alpinisme
6 months ago
[–]
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:
[1]: https://www.learningtypescript.com/articles/branded-types