4 ms·
One major distinction with this is between structural types (if the shape is right, it fits) and nominal types (only the same reference will do). For nominal t
by 3np 2y ago
One major distinction with this is between structural types (if the shape is right, it fits) and nominal types (only the same reference will do).
For nominal types, you also want to pay an eye to only ever refering back to the same one-true-definition and not duplicate them (example: TS enums and classes). Whereas with structural types (example: TS interfaces) you can get away with being a lot more ad-hoc without having to enforce a globally unified structure. This highlights the value of the age-old principle of always exposing interfaces rather than implementations in your typings (every exposed class should have at least one corresponding interface).
This is why the Haskell example works out fine since Haskell tuples are structural.