|
|
|
|
|
by a0
2485 days ago
|
|
Many modern languages support type inference to some degree. The special thing about ReasonML is that the type inference is much more robust and complete. In practice you don't need to provide any types annotations at all at any point in your program and you should still get the same safety benefits. Every value in your code will automatically have one single type assigned to it based on how it is being used. When the compiler finds contradictions it will let you know about it. On the other hand, Typescript will try to unify the type to some sort of Any, which is probably not what you want. |
|
Types offer inline documentation to developers that come after you. They should make it easier to establish and maintain a mental model.
Obviously, this requires buy-in from all parties, but if the tool itself doesn't encourage buy-in, it is a bug, not a feature.