3 ms·
> it's also freed of the type wrangling and gymnastics needed to please the TS compiler. If you're fighting typescript that much, then what's the point? The
by preommr 3y ago
> it's also freed of the type wrangling and gymnastics needed to please the TS compiler.
If you're fighting typescript that much, then what's the point?
The point of using things like types is correctness that can be statically checked. Imagine writing java (or any static typed lang) code where you just pass around a base class( e.g. "Object") and explicitly cast up to what you want, there'd be no point in using that language.
- sverhagen 3y agoI've worked in that place. (And ran.)
- digging 3y ago> If you're fighting typescript that much, then what's the point? Agreed - I find these "wrangling" situations to be uncommon, and roughly half of the time they happen because our code is bad and we need to change it. The other half - well, sure, it can be a pain in the ass, but there's no such thing as code so elegant that it never has some irritating high-effort corner cases. I'll take deterministic type wrangling over raw untyped JS.
- Gigachad 3y agoEvery time I’ve had to “wrangle typescript” it’s been converting old JS files where someone has done something that neither me nor typescript can work out what is going on.
- dahwolf 3y agoExcept that most code actually isn't passing around random unnamed objects of unknown type or contents. Their meaning and type are implied clearly enough in many if not most cases by their name and usage. Hence, the downside is doing a lot of work to describe things we already know whilst making code less readable (or at least longer). I'm still largely in favor of Typescript, I'm just suggesting to not misrepresent the situation of not having Typescript.