What I meant by “making type errors clear” wasn’t so much the text of the error messages, but rather making the cause of the error more obvious. Here’s a very simplified example of the sort of thing I mean:
function foo() {return '1.2'}
const bar = foo() + 1
const baz = bar.toFixed()
ESInfer complains on line 2, and TypeScript on line 3 (I guess it understands that `+` will coerce the type), but from my perspective the mistake is on line 1, where I forgot parseFloat(). Without annotations, the problem manifests as individual errors somewhere downstream of every call site; if I annotate foo() as returning a number, the type checker will immediately point me at the problem. In fact when I get a type error from tsc that I don’t immediately understand, my first step is usually to start scattering annotations around to help it narrow down where its take on the situation differs from mine.Basically, neither ESInfer nor TypeScript give me great diagnostics for this code as-is, but TS lets me have a ‘conversation’; it has the tools I need to help it help me find the problem. ESInfer (in my admittedly cursory understanding) seems like it’s missing that ability; I can imagine a heuristics that would help it better explain the situation (e.g. showing the entire data flow that lead to a mismatch, rather than claiming the error is at a single point) but I haven’t thought about it very much so I was wondering if you had any particular ideas around this situation.
(Incidentally, you can find the syntax for HN comments at <https://news.ycombinator.com/formatdoc>. It’s linked from the FAQ, which is itself linked at the bottom of the page, though that’s not very obvious.)