|
|
|
|
|
by tigershark
2717 days ago
|
|
You can’t have the same level of correctness as ocaml if you want to maintain the compatibility with JavaScript.
Typescript type system is unsound for this reason.
You can’t have anything approaching ocaml correctness when in typescript all objects with the same shape are interchangeable. |
|
If everyone just accepted the argument 4 years ago that "JS will never be sound" then maybe today TS would still just be Java style `interface` annotations for classes. It's not like the Flow team has reached a ceiling at this point... there's still plenty on their roadmap that would continue to improve soundness and expressiveness.
> You can’t have anything approaching ocaml correctness when in typescript all objects with the same shape are interchangeable.
Could you elaborate? Flow has recently switched to exact objects by default[1], which I would have thought would be enough for a sound approach?
[1] https://medium.com/flow-type/on-the-roadmap-exact-objects-by...