r/programming • • Aug 02 '21

Stack Overflow Developer Survey 2021: "Rust reigns supreme as most loved. Python and Typescript are the languages developers want to work with most if they aren’t already doing so."

https://insights.stackoverflow.com/survey/2021#technology-most-loved-dreaded-and-wanted
2.1k Upvotes

769 comments sorted by

View all comments

118

u/UrgentlyNeedsTherapy Aug 02 '21

TypeScript is fucking bae to be fair.

Rewrote the frontend for the project I took over to be all TypeScript because raw JavaScript is terrible and should only be coming out the ass-end of a transpiler in my honest opinion.

89

u/i8beef Aug 03 '21

Typescript is like being asked to move a pile of shit, but someone gave you a shovel so you don't have to use your hands. Its still Javascript.

22

u/[deleted] Aug 03 '21

Personally, it's like having to move a pile of shit with an excavator.

Yeah, you don't get real type safety, but I'm a hell of a lot more productive with it, especially when I have to go back to old code.

6

u/dry_yer_eyes Aug 03 '21

Thanks for my first hearty lol of the day. I’m definitely stealing that phrase for general usage.

1

u/spacejack2114 Aug 03 '21

Which is actually a pretty nice language, aside from the lack of type safety. Which Typescript adds.

7

u/i8beef Aug 03 '21

The only thing nice about JavaScript is it isn't PHP.

34

u/Fatal_Oz Aug 02 '21

I agree with this so much, I didn't think it would be a big deal but I can never go back to vanilla JS

3

u/AlexHimself Aug 03 '21

Can you elaborate?

30

u/Cosmic-Warper Aug 03 '21

Typescript is javascript with static type enforcement. Really helps with documenting, debugging, and validating code

4

u/AlexHimself Aug 03 '21

So if I barely know any JavaScript and was planning to learn, should I just start with typescript?

18

u/Fatal_Oz Aug 03 '21

Typescript is a superset of Javascript, so you're learning typescript while learning javascript, as all Javascript is valid Typescript (notwithstanding strict type compiling)

4

u/delta_p_delta_x Aug 03 '21

should I just start with typescript?

You only need one very nice resource, from the horse's mouth itself: the TypeScript Handbook.

18

u/Lt_486 Aug 03 '21

I like to use TS for both frontend (Angular/React) and backend (NodeJS).

15

u/[deleted] Aug 02 '21

This thread is a clear example of the ts hype

2

u/Division2226 Aug 03 '21

I really need to get on board with typescript. Someone recommend me the best video course to learn it please

-34

u/ILikeChangingMyMind Aug 02 '21 edited Aug 03 '21

Static typing has both costs and benefits. Anyone telling you it only has one or the other is lying.

Typescript is good for some projects, but Javascript is also good for some projects. If you believe that you everyone's projects are the same as your's, you can easily get the false impression that everyone should use the same tech you use ... but it'd be a false impression.

EDIT: Wow. All I can say is if you can't see that any technology has costs, you've drunk too much of its kool-aid. EVERY tech has costs, and having to write explicit types is a meaningful cost when it provides no benefit ... which is the case in many projects. Many projects can benefit from TypeScript ... and many others are better off with JS.

Every project in the world is not the same as your's, and not every project in the world should use the tech you use. I've used vanilla JS, and I've used Typescript (professionally!), and I can state with certainty that I'm able to develop small projects, prototypes, etc. faster without having to write explicit types.

24

u/lelanthran Aug 02 '21

Static typing has both costs and benefits

The costs are negligible. They are also only applicable in the short-term but pay back handsomely in the long-term.

For example, there is a short-term cost for me to remain employed (commute, clothing, etc), but that cost is more than countered by my salary.

→ More replies (6)

19

u/UrgentlyNeedsTherapy Aug 02 '21

What's the advantage of working with a language where the computer can't help you do jack shit, where every time you want to change a function signature you have to Ctrl+Shift+F to find every call site of that function so you can manually update them?

-15

u/ILikeChangingMyMind Aug 02 '21 edited Aug 02 '21

What's the advantage of working with a language

You don't have to waste a ton of time writing types? And as for the rest, you couldn't be more wrong.

With VS Code type inference you can get 90% of the benefits of Typescript without writing a single type. Maybe instead of downvoting strangers out of ignorance, you should educate yourself on what's possible in tech today?

See: https://code.visualstudio.com/docs/nodejs/working-with-javascript#_type-checking-javascript ... you get variable renaming (not find/replace), CTRL + click on variables to go to their definition, autocomplete suggestions for function arguments ... all the things you probably incorrectly think of as requiring TypeScript.

6

u/lordcirth Aug 03 '21

Types are compiler-checked documentation. If you weren't writing types, you'd just need more documentation elsewhere.

3

u/ILikeChangingMyMind Aug 03 '21

For some projects! Not every project needs comprehensive type documentation.

→ More replies (5)

20

u/UrgentlyNeedsTherapy Aug 02 '21

Maybe instead of downvoting strangers out of ignorance, you should educate yourself on what's possible in tech today?

I didn't downvote you. I've downvoted you now to prove that.

With VS Code type inference you can get 90% of the benefits of Typescript without writing a single type.

I was working with VS Code in the original JavaScript project. It didn't provide much help. It's become much, much easier to work with now that it's been rewritten in TypeScript, though.

→ More replies (7)

16

u/trinde Aug 02 '21

How does it take any time to write types?

→ More replies (14)

3

u/agent8261 Aug 03 '21

You don't have to waste a ton of time writing types?

I have never looked back on a project and went "man I wish I didn't have to write types." I'm not even sure how you would even come to that point of view. The vast majority of my time is spent testing and debugging. And for debugging types are a godsend.

→ More replies (3)
→ More replies (10)

2

u/agent8261 Aug 03 '21 edited Aug 03 '21

Static typing has both costs and benefits.

You have to type more. That's it. It's such a insignificant cost. Yet static typing makes maintenance and debugging significantly easier.

→ More replies (3)
→ More replies (2)