3 ms·
> and many JS APIs, especially older ones, don't even have types yet. This is pretty much not the case these days, the packages people use mostly have types.
by zachrip 2y ago
> and many JS APIs, especially older ones, don't even have types yet.
This is pretty much not the case these days, the packages people use mostly have types.
- lblume 2y agoExactly, if they are used enough that someone declared the types in a @types subrepo. Sometimes these are excellent. However, I sometimes work with code in fairly niche domains written in pure JS that can pretty much return anything depending on the input (not necessary even input types), rendering even these bindings very hard to write and not ergonomic at all. And this sometimes holds for even fairly popular libraries, like d3.js which I sometimes use for visualization. The idiosyncratic API design for object manipulation, selecting DOM nodes by string id and doing stuff based on their associated data, just doesn't really work in a strongly-typed context without 50% of the code being unreadable casts. And d3 is still trying at least to be somewhat type-safe, unlike other libraries.