3 ms·
I feel this, but with Typescript (coming from jQuery and then ES4/5). I love how it forces you to code well. You can change your tsconfig to ignore the strictn
by NetOpWibby 2y ago
I feel this, but with Typescript (coming from jQuery and then ES4/5). I love how it forces you to code well.
You can change your tsconfig to ignore the strictness but I don’t.
- lblume 2y agoBy default, strictness is opt-in with TypeScript, and many JS APIs, especially older ones, don't even have types yet. Having a type system from the start that cannot be disabled and that forces you to always think of types instead of allowing sprinkling 'as any' when the code works but doesn't compile which is a major annoyance, is a huge benefit in my opinion.
- 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.
- augusto-moura 2y agoAll JS APIs are typed (browser, nodejs, etc.), if you meant libraries, yes, not all of them are typed. But the vast majority have community types in DefinitelyTyped. Also, it is trivial to type an unknown library yourself, or at least type only the relevant parts for your work.