Live data from Hacker News

How an Anti-TypeScript “JavaScript developer” like me became a TypeScript fan

chiragswadia.medium.com

61–70 of 400 posts

Re: How an Anti-TypeScript “JavaScript developer” like me became a TypeScript fan

#61
post #8

For me, I can handle the lack of static typing when I'm doing small scripts, like if it's going to be 100 lines or so of Python (my go-to language if I need to test some math out in a sandbox or do some file manipulation on my system). I might actually be a little faster in writing those scripts because of the lack of typing. Once it starts getting any bigger than that, though, static typing really catches and points…

Naming is incredibly hard, though. And refactoring is hard. It's a pain in the neck when something starts out as bla_list or whatever and you discover that after half a decade of changes bla_list isn't actually a list anymore, it's a dictionary, and that it doesn't only hold Bla these days, it can also contain Foo or Bar. This type of stuff is immediately obvious with modern static typing.

This feels more like developers learning that any variation on Hungarian notation is a bad idea.

Re: How an Anti-TypeScript “JavaScript developer” like me became a TypeScript fan

#62
post #18

Earlier quoted context omitted.

Agreed, though at least there's one less developer writing about the "TypeScript Tax".

I am a TypeScript fan but I do acknowledge the existence of the tax. TS is another cog in the machine that does useful work but can sometimes confusingly interact with other cogs (e.g. miles long unreadable TS errors coming out of React). Using or not using TS is not a trivial decision to me and should be made with consideration to the complexity of your stack.

Can relate about illegible React stack traces in production builds. One of the reasons in my case was Create-React-App obfuscating ES6 class names, which is just insane! Just why???! Why throw all code structure away just to save a couple KBs. The worst part is CRA folks acting like dictators when asked to provide an option to toggle that: "Why in heavens earth would you need that?". "You can fork our 30K+ line repo [just to toggle minification] if you want".

Sorry for the off topic rant!

P.S: Yes I know source maps exist. They suck/aren't reliable.

Re: How an Anti-TypeScript “JavaScript developer” like me became a TypeScript fan

#64

For me, I can handle the lack of static typing when I'm doing small scripts, like if it's going to be 100 lines or so of Python (my go-to language if I need to test some math out in a sandbox or do some file manipulation on my system). I might actually be a little faster in writing those scripts because of the lack of typing. Once it starts getting any bigger than that, though, static typing really catches and points…

SQL is not typed, it is just text sent over a network or whatever and then parsed...

The schema and functions are typed.

Re: How an Anti-TypeScript “JavaScript developer” like me became a TypeScript fan

#65

While I'm fan of statically typing, there is something with Typescript I don't like, but don't know exactly what it is. In my day-to-day it's mostly Kotlin and Elm, which also are both statically typed, which I don't mind and mostly don't even notice. But with Typescript it is as if I'm always fighting the compilator, trying to make it happy with whatever code I wrote. Maybe it's just the JS ecosystem being too lax t…

I had this too - when I first started I fought typescript quite a bit. I struggled through this because I kept finding more and more code on github that was TS, kept seeing more articles that were TS, kept seeing big improvements from MS on TS, etc. So I kept learning the best practices and trying to understand why I shouldn't use "any[]" or "{key: string?}" and so on - trying to get past the parts where I wanted to be lazy. Eventually on one of my projects I had to reorganize my model structure, where some classes held other classes and so on. I had to both move one and rename one. This was early on, but since I did a reasonable job with typescript, I was able to just run `tsc -p .` over and over and it found all of the places I missed, which were far more than I would have guessed. It only took maybe 20 minutes to do that massive refactor. From that day forward, I really enjoy working in typescript. I think it's different from (some) other strongly/statically typed languages because it allows you be be a little more expressive in what you're defining. Perhaps expressive is the wrong word, but I find that it's quite flexible in this area, and I really enjoy that because if I take the time to flesh things out it can really help me find or prevent bugs.

Re: How an Anti-TypeScript “JavaScript developer” like me became a TypeScript fan

#66
post #33

Earlier quoted context omitted.

Typescript is hardly "new", it's fairly widely accepted now. It might be worth thinking "why do all these people enjoy using Typescript?". or idk just say that no, its the kids that are wrong.

Typescript is not accepted. How AngularJS stuck on 1.* is the best proof, and an illustration for the problem. Pretty serious people are working in Angular community, it's immensely popular in the enterprise webapp space, so I will not take the "Ah, it's just amateurs who are stuck there." It adds to countless attempts of other transpiled *scripts to extend Javascript. They, and Coffeescript in particular, are good h…

I wrote AngularJS 1.x in TypeScript in an enterprise application. Being "stuck there" ("there" meaning pure JS for Angular 1.x) is a choice.

Re: How an Anti-TypeScript “JavaScript developer” like me became a TypeScript fan

#67

It's probably worth taking a step back and interrogating why the actual "Why was I Anti-TypeScript?" a little bit more and use it as an opportunity for broader self development. The author didn't use and understand something, and rather than trying to they instead just defaulted to rejection. It's midly disapointing seeing this in people who label themselves as "Senior".

I’d consider myself senior. I’ve been using Javascript since it was beta. I like Javascript. I don’t mind TypeScript. I mean, it’s nice and all but it doesn’t strike me as the be-all that others make it out to be. Maybe I just don’t use it for the types of project for which it was designed.

It’s like I’m a metal worker and I get along fine with a ball peen hammer. You come along and give me your claw hammer with great excitement. Sure, it can mostly do the same job, but my ball peen hammer is what I’m used to so I’m sticking with it.

Re: How an Anti-TypeScript “JavaScript developer” like me became a TypeScript fan

#68

Don't want to oversimplify since the article has some useful insights, but overall it reads like a typical transition from thinking static typing is a burden to realizing type safety can be incredibly useful. I distinctly remember that in college I believed the history of programming languages is purely evolutionary in the sense that newer languages are objectively better than older ones. As in - people wrote assembl…

> but overall it reads like a typical transition from thinking static typing is a burden to realizing type safety can be incredibly useful.

I got this impression too, I was just like the Author in that I hated static type checking as a Junior, but as I gained more experience it flipped from "I hate this" to "this is the first thing I implement in a new project".

To your point of thinking that newer languages being "better" than older ones. I think that also comes down to experience. At first I thought the same way, but the most experience I gained the more I realized that each language is a specialized tool for using in specific cases, some tools are very very specialized (WASM for example) while others are broad (like Javascript).

Re: How an Anti-TypeScript “JavaScript developer” like me became a TypeScript fan

#69
This article echos the common complaint I've seen from people hesitant to adopt TS.

"I always used to get some compilation errors which were hard to understand initially, and I scratched my head trying to figure out the problem. "

Which is like saying, "I got rid of my carbon monoxide detector because it kept beeping at me"

Re: How an Anti-TypeScript “JavaScript developer” like me became a TypeScript fan

#70
post #8

Earlier quoted context omitted.

Naming is incredibly hard, though. And refactoring is hard. It's a pain in the neck when something starts out as bla_list or whatever and you discover that after half a decade of changes bla_list isn't actually a list anymore, it's a dictionary, and that it doesn't only hold Bla these days, it can also contain Foo or Bar. This type of stuff is immediately obvious with modern static typing.

This feels more like developers learning that any variation on Hungarian notation is a bad idea.

You have to account for developers learning, for any code base, though. Let alone for third party dependencies :-)
Post reply on HN