top | item 37407376

(no title)

bil7 | 2 years ago

My least favourite thing about vanilla JS is finding out at runtime that I made a typo. That's an annoying thing that TS completely solves, among many others. I really don't see how you could use TS for any amount of time and wish to revert back.

>Things that should be easy become hard, and things that are hard become `any`. No thanks!

Denouncing a type system because you refuse to use it correctly seems short sighted to me, but I am of course biased as a TS fan.

discuss

order

bottlepalm|2 years ago

I often wonder if people who have trouble typing things, or have to us the 'any' type, ever really learned how to program.

didntcheck|2 years ago

Yep, when I hear people say things like "I like $dynamic_language because I don't have to think about what types I'm supposed to put when I write my functions" or similar, I'm just thinking "how the hell can you write a function without knowing what types you want to receive and return?". I do love the "productivity benefits" of having to read entire function bodies to reverse-engineer what types I'm supposed to pass, because the docstring just used vague terms like "file" or "user"

etler|2 years ago

I find that areas that are hard to type are a code smell indicating potentially unstable API design. It can be pretty tricky adding types to a JavaScript project as the lack of types can lead to some very side effecty apis that can be very difficult or impossible to add full type safety to.

My impression is that people running into these problems are trying to add declaration files to JavaScript code, but if you use typescript throughout I've not run into these problems.

Anything I find hard to type is simply a hard problem to solve in the first place and the type system helps me rethink the problem to find safer and more elegant API designs.

tvink|2 years ago

So the only real way to learn how to program is to learn typed programming?

Meaning you could create most modern applications (including this very website) without really learning to program...

Fun perspective.

quickthrower2|2 years ago

any (concept not keyword) is useful when you NPM install something without types and just do a define module in a local .d.ts. You are implicitly any-ifying that package.

claytongulick|2 years ago

Probably true. After 30 years of writing code, I guess I just haven't figured it out yet.

Thankfully you and Typescript are here to show me how to do it right.

Brendinooo|2 years ago

I felt similarly. But ultimately, TS is there to solve a particular set of problems, and if they're able to solve their problems without it, more power to them I guess.

etler|2 years ago

The benefits of typescript when refactoring is immense. I have a really hard time understanding how someone could not see the net productivity gain if they've experienced refactoring in typescript vs JavaScript.

sngz|2 years ago

> I have a really hard time understanding how someone could not see the net productivity gain if they've experienced refactoring in typescript vs JavaScript.

cause I spend more time debugging other peoples typescript code that is usually a typescript problem and is obfuscated by the extra layer. If we used vanillaJS then it would save everyone so much time.

hinell|2 years ago

It's not a Type System denouncement, it's denouncement of crappy TS and that's the right choice.

sngz|2 years ago

sounds like a user problem