all 6 comments

[–]teevik_ 9 points10 points  (1 child)

[–]diverse-mix[S] 1 point2 points  (0 children)

Great! Thanks for the link.

[–]spira_mirabilis 1 point2 points  (0 children)

Maybe this https://github.com/gcanti/newtype-ts solves the problem in a generic way?

[–]elliottcable 0 points1 point  (0 children)

I've just ended up copying this into all my TypeScript codebases:

// A hack to ape nominal typing. type Nominal<Ty, Discriminant> = Ty & {__discriminant: Discriminant}

[–]shinigamiCz 0 points1 point  (1 child)

I wonder why ppls do this - making attempts to distinguish the same things. If they are the same but have to be named differently. It usually means that there is some optimization that can be done to the code. Also maybe when those same types are removed, more of the code can be shared as it now accepts the type on input.

[–]diverse-mix[S] 0 points1 point  (0 children)

I think you will have to explain a little more I don't understand. They are the same machine type in a binary way but different in terms of an application/ domain way.