Hacker News new | ask | show | jobs
by bgschiller 2155 days ago
There are a couple of attempts in that direction with TypeScript[1,2]. A bit more work than if there was direct language support, but I've used "branded types" to distinguish between UserIds and ProductIds, between different types of currency, and between different unit systems.

1: https://spin.atomicobject.com/2018/01/15/typescript-flexible...

2: https://basarat.gitbook.io/typescript/main-1/nominaltyping