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

Is there something wrong with creating opaque types using this method?

  type ObjectId = string & { 
  readonly __tag: unique 
  symbol }
This way, we don't need to use `never`, but we still prevent the creation of a structurally equivalent type by mistake.


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

Search: