Re:Branded Types for TypeScript
by freeney on Wednesday May 15, 2024 @09:01AM
(#40366351)
Flow has actual support for this with opaque types. You just use the opaque keyword in front of a type alias ˋopaque type Hash = string` and then that type can only be constructed in the same file where it is defined. Typescript could introduce a similar feature
[ Parent
| on HN ]
There are no comments on this comment yet.