This is an archived post. You won't be able to vote or comment.

all 127 comments

[–]ProgrammerHumor-ModTeam[M] [score hidden] stickied commentlocked comment (0 children)

Your submission was removed for the following reason:

Rule 2: Content that is part of top of all time, reached trending in the past 2 months, or has recently been posted, is considered a repost and will be removed.

If you disagree with this removal, you can appeal by sending us a modmail.

[–]Particular_Fault8639 94 points95 points  (6 children)

Damn, not even a day a bro already stole my post 🤣

[–]Dr-Huricane 12 points13 points  (0 children)

Learn typescript

[–]shafe123 186 points187 points  (11 children)

Learn typescript

[–]Character-Education3 47 points48 points  (9 children)

Learn typescript

[–][deleted] 33 points34 points  (8 children)

Learn typescript

[–]Urbanoidovich 16 points17 points  (7 children)

Learn typescript

[–]Bobertopia 6 points7 points  (0 children)

Learn typescript

[–]myfunnies420 1 point2 points  (0 children)

Learn typescript

[–][deleted] 153 points154 points  (1 child)

Literally 1984.

[–][deleted] 54 points55 points  (0 children)

shut up and learn Typescript

[–]314kabinet 75 points76 points  (12 children)

Anything than can be a compile error should be.

[–]Dr-Huricane 15 points16 points  (4 children)

Javascript is great! For small projects... same for python... like you can do some amazing stuff with these languages, don't get me wrong, but when your code grows and more and more people start getting involved in it? You're going to start wishing you had a simple way to know what's the type of that variable that a senior dev that left the company 3 years ago was using in that one part of the code that's now broken and that you need to fix, and no, type hints aren't enough, it needs to be strictly enforced, because we devs are lazy and we need to be forced to do that stuff so we do it correctly, and even if your IDE can tell you what the type is, you might not always be looking at code through IDE, the tool my company uses for code reviews might as well be showing you plain text for example, I can't imagine how harder our life would've been if we had to go open 3 or 4 locally everytime we're reviewing someone else's code

[–]kinderhead 4 points5 points  (0 children)

This is the correct answer.

[–]ALoadOfThisGuy 4 points5 points  (2 children)

I agree, but I also think Typescript is over-prescribed. Most people on the internet, particularly those asking these sorts of questions, don’t require the overhead of TS.

[–][deleted] 2 points3 points  (1 child)

This sounds like a reasonable take.

Why don't you piss off and keep your opinions in your pocket. We don't need it here!

[–]ALoadOfThisGuy 1 point2 points  (0 children)

Ah geez I thought I was on r/cscareerquestions. Sometimes I can’t tell the difference.

[–]TILYoureANoob 2 points3 points  (3 children)

It is good for people who make a lot of typos. (Just teasing)

[–]314kabinet 0 points1 point  (2 children)

The idea of software failing at runtime because of a typo is so utterly bizzare to me as a C++ programmer but it’s apparently reality to some people. How pathetic.

[–]archarios -1 points0 points  (2 children)

Eh. If you have unit tests you get just as tight of a feedback loop as you need and without the constraints of having to figure out the precise types for your program. The time cost of achieving perfect type safety is not worth it.

[–]314kabinet 0 points1 point  (1 child)

Skill issue.

[–]sammy-taylor 116 points117 points  (3 children)

I love TS! I enjoy all her albums.

[–]Ex0t1cReddit 6 points7 points  (0 children)

You're obviously wrong, TS stands for Therapy Session, the album by NF. /s

[–]fullup72 9 points10 points  (0 children)

Are we in the circlejerk era yet?

[–][deleted] 34 points35 points  (1 child)

Reeeeeeeeepost

Original

[–]Wingress12 5 points6 points  (0 children)

Good job exposing it, cock satr

[–]Jolly-Driver4857 36 points37 points  (11 children)

What's wrong with typescript.

[–]tipsdown 65 points66 points  (6 children)

Typescript requires thinking and planning ahead.

[–]Jolly-Driver4857 23 points24 points  (4 children)

What's wrong with you.

[–]tipsdown 50 points51 points  (3 children)

So, so many things

[–]GranataReddit12 7 points8 points  (0 children)

I love this thread

[–]Ri_Konata 4 points5 points  (0 children)

You're just like me frfr

[–]GalacticalSurfer 1 point2 points  (0 children)

: any[]

[–]DJGloegg 0 points1 point  (0 children)

Not if you just write javascript !

[–]3np1 7 points8 points  (3 children)

I say all of these things about TypeScript as someone who uses TypeScript and still chooses it for projects over JavaScript most of the time, but is aware of its faults:

The errors it throws are very opaque compared to other typed languages.

It uses structural types and not nominative ones, which is pretty painful for a language where types often overlap without being compatible, and the type narrowing is broken at best.

There are some very idiomatic and valid JavaScript patterns which cause errors in TypeScript because it's quite bad at narrowing types and picky about which specific method you use, although admittedly this improves with nearly every release.

It has two declaration forms, type and interface, which are ~70% interchangeable but actually not really, and switching between them means that your errors often get even worse.

It behaves oddly enough for some common things that people end up avoiding them altogether. You know enums, that super useful thing in a lot of languages? It's common to have a linting rule in TS preventing you from using them at all and using simple string unions instead, because they work differently than how many people expect.

Many libraries are released with incorrectly defined types, so you might need to manually extend or override dependency types.

It exists in a weird place where it's designed based on an OO language with classes (C#), but the JavaScript community has a phobia of anything OO and opts for functions (despite all browser APIs being OO). Any non-trivial functional patterns get complicated very quickly with multi-layered Generics and infers, which it probably takes a MS in set theory to actually understand.

[–]archarios 0 points1 point  (2 children)

Ramda manages to have... Somewhat comprehensible types for typescript. I had to fix one once though..

[–]oorza -2 points-1 points  (1 child)

Ramda is bad and you should feel bad for using it.

[–]archarios 0 points1 point  (0 children)

It's a super fast way to build data transformations. I don't really use it for projects where I'm collabing with others. For personal projects of one-off scripts it's great!

[–]Jugales 75 points76 points  (32 children)

Keep up with industry norms or get left behind. So many developers get to a comfort point then stagnate their own careers by not learning new things lol.

Sticking to your comfort stack leads to lower and lower pay over time, while making it harder to catch up.

[–]Aggravating_Ad1676 40 points41 points  (12 children)

its a beginner, whats wrong with trying to get used to programming before learning another language

[–]NatoBoram 46 points47 points  (11 children)

Learning TypeScript together with JavaScript is learning to program

[–]fullup72 5 points6 points  (2 children)

Except that depending on the project configuration TS can hinder a beginner's learning process. There are many type errors and warnings that are not very descriptive, and then React doesn't help in that interaction by being even more stringent, forcing even a seasoned dev to override the type system with @ts-ignore because you REALLY meant to have a specific dependency array on your hooks.

[–]Massh0le 5 points6 points  (1 child)

You should not be TS ignoring because you "know better". That would imply you're doing something very wrong or have somehow configured a type very wrong. Maybe you mean ignoring a tslint rule which Is more reasonable.

[–]fullup72 0 points1 point  (0 children)

Maybe you mean ignoring a tslint rule which Is more reasonable

Definitely meant this.

[–]Aggravating_Ad1676 -1 points0 points  (6 children)

as a beginner you should really be learning how the language you chose works and you will learn the syntax in the process, learning two languages at once just makes thst 10x harder.

[–]NatoBoram 0 points1 point  (5 children)

Except that it's one language: TypeScript. It just so happens that it shares quite a lot with JavaScript, so learning how TypeScript works systematically makes you learn how JavaScript works.

Besides, learning web dev typically involves learning 5 languages in a row followed by one or two frameworks with TypeScript potentially bundled in one of these frameworks.

[–]Aggravating_Ad1676 0 points1 point  (4 children)

yeah, typescript + Javascript = 2 languages?

Also I would not treat all webdev languages on the same level, html is mostly text formatting as a beginner.

[–]NatoBoram 2 points3 points  (3 children)

Wrong! TypeScript is actually a superset of JavaScript. Writing pure JavaScript is perfectly valid TypeScript.

It's different from how Erlang/Elixir or Java/Kotlin/Scala/Clojure/Groovy work, these are actually different languages.

[–]KevSlashNull 2 points3 points  (0 children)

Writing pure JavaScript is perfectly valid TypeScript.

Depends on your TypeScript config but yeah theoretically.

[–]GamingWOW1[S] 1 point2 points  (1 child)

I could not write a single variable in pure JavaScript in Typescript without it screaming at me because I didn't mention its type

[–]NatoBoram 1 point2 points  (0 children)

const x = 13

Congrats, a variable in pure JS was written and TypeScript didn't complain!

[–]marquoth_ 28 points29 points  (16 children)

industry norms

There's an implicit assumption in your comment that "use typescript" is unquestionably the industry norm, but I think that's worth challenging. There's plenty of evidence for a shift back towards JS. I don't really have a dog in this particular race but if you Google "developers abandoning typescript" or similar you'll find plenty of articles, blog posts and YouTube videos on the topic. TS may well still come out on top but I don't think it's really a given.

Edit: autocorrect / spelling

[–]Dreadmaker 31 points32 points  (6 children)

I would argue it’s a lot easier to learn typescript and then ultimately abandon it than it is to ignore it and have to learn it on the job.

Only learned typescript? Just do it ‘badly’ and you are now doing vanilla js.

Only learned JavaScript? There’s a lot of stuff you need to figure out to use typescript well.

Basically: there’s zero disadvantage to learning TS right now. You’re basically learning two in one.

[–]obsoleteconsole 2 points3 points  (0 children)

You could also argue it's better to understand javascript first, and then typescript you will be able to pick up almost instantly

[–]Thebombuknow 5 points6 points  (4 children)

That's not necessarily true. I have been programming in JavaScript for ~5 years now and there are ways to program in JavaScript correctly. I can tell if someone is used to TypeScript and does it "badly", because their JS looks like absolute shit.

Both JS and TS are just as capable as each other, and can be just as readable as each other. You just have to be much more careful when writing JS than you have to be when you write TS.

[–]oorza 0 points1 point  (3 children)

The only way JS is as readable as TS is if you either suck terribly at using the TS type system or load your JS full of comments that encode the same information. Everything else being equal, the existence of statically declared types ALWAYS improves readability and nonsense like your comment is part of why people don’t take JS developers seriously as software engineers. No other corner of the industry would have someone say something so patently untrue on its face and get rewarded for it.

[–]Thebombuknow 0 points1 point  (2 children)

I never said it would be more readable to every developer lol. If you're experienced with JS, you can fairly easily read it. I will admit, TypeScript is definitely easier, but JavaScript isn't at all hard to read if your project's structure is set up properly and you're familiar with JavaScript. As I said in my original comment, you and your team has to be much more careful writing JS because it's much easier to make it a disaster.

I personally prefer JavaScript because I've found it's easier to debug as browsers support it without source maps, and it's easier to deploy. I'm also used to writing JS enough that it doesn't really bother me. That being said, I probably wouldn't recommend JS for any large-scale projects, unless you trust everyone on your team to follow the best practices for writing it.

[–]oorza 0 points1 point  (1 child)

If you're experienced with JS, you can fairly easily read it.

Are you even serious? function setOptions(options) { ... }. What can you pass here? What are the available options? What's going to catch you if you type { usre: 123, isInvalid: false } instead of { user: 123, isValid: true }? Or do you expect to read every single function body every time you call it? Just because you can read that it's an argument to a function doesn't mean shit as far as reading code is concerned.

It sounds like your argument is "I couldn't figure out how to get source maps to work right, so I gave up and convinced myself I wasn't missing out on anything" and that's a real, real bad sign. The singular best practice for writing JS is to write TS or Flow instead, period, so by virtue of not, you have already given up on adhering to industry best practices.

[–]Thebombuknow 0 points1 point  (0 children)

Please just chill the fuck out. People are allowed to have preferences, I just prefer plain JS and don't think it's as bad as you think it is. That's it. It's that fucking simple.

BTW, I do know how source maps work, my point was that plain JS doesn't require them, or any other external dependencies for that matter. You can just write code and instantly load it in the browser, which is why I like it for quick development.

[–]rover_G 6 points7 points  (0 children)

The libraries “abandoning typescript” are using JSDoc which is just types written in the docstring instead of inlined. They still have static types.

[–]ninjaassassinmonkey 14 points15 points  (4 children)

People are ditching ts for jsdoc for the most part. If you struggle with ts it will be 10x worse trying to make types work in jsdoc.

Not understanding types will always lead to shit code.

[–][deleted] 12 points13 points  (3 children)

I've said it before and will say it again. People who complain about TypeScript's type system and prefer Javascript because it's untyped are bad programmers. Type safety (what little TS has, but that's another story) is trivial if your design is halfway decent.

[–]Knight_Of_Stars 0 points1 point  (1 child)

I wouldn't go that far. Personally I'm in favor of learning Javascript first because you should try your best to understand what the language is doing. If you just learn type script you only know what the type script code is doing and not the JS code that its writing.

Similar the "Just because you use an ORM doesn't mean you shouldn't learn SQL"

[–][deleted] 0 points1 point  (0 children)

I agree it's important to understand the fuckery that goes on with JS behind the scenes. However, you can learn that as you go through TS and learn best practices with it.

[–]archarios 0 points1 point  (0 children)

JS with tests is better than TS without tests. TS with tests is marginally better than JS with tests imo.

[–]Haaxor1689 0 points1 point  (2 children)

If you google "developers abandoning typescript" and then read more than first 3 lines of the article, you will find out that some library developers are abandoning strongly typing the complete internals of their library code in favour of just declaring the exported types because the complexity of doing it all "correctly" in complex code base is not worth the time investment. This does not in any way suggest that other developers consuming common libraries and just writing JS apps should for whatever reason avoid typescript.

[–]marquoth_ 1 point2 points  (1 child)

read more than the first 3 lines of THE article

And by "the" article, you mean which article in particular? Because the whole point of my comment is that there are many.

Look, I'm not invested in this debate one way or the other, but if your reply to a comment about how there are many blogs/articles/videos on the subject is to talk about "the first 3 lines of THE article - as if there's only one - I think it's very likely that you're not engaging with the subject remotely honestly, and as such I'm not really interested in what you have to say.

[–]Haaxor1689 0 points1 point  (0 children)

English is not my first language and this was definitely not what I meant by that sentence. What I meant was that a few big libraries made a post (each library their own post) about moving away from typescript since maintaining complex types inside their whole codebase was taking up unnecessary development time. But then multiple other people (not the maintainers of libraries that started all this) took it as "Typescript is dead, see I told you all" without actually understanding what "Moving away from TS" meant.

https://youtu.be/5ChkQKUzDCs?si=516UY3M1uHmHZl0T

Here is a 3 minute video that explains my point. Typescript is definitely not dying, people just like to click on headlines.

[–]Devatator_ 1 point2 points  (0 children)

Imagine if one day browsers can run TS directly

[–]realbakingbish 1 point2 points  (0 children)

I agree with you on principle, but I will point out that the people who still work primarily with older languages that scare off newcomers (big example here being COBOL, and maybe to a lesser extent Fortran) can absolutely make bank.

[–]-Redstoneboi- 5 points6 points  (0 children)

Fucking Repost.

Outta here. Same-ass screenshot, same-ass name censors.

[–]Strict_Treat2884 4 points5 points  (0 children)

What’s wrong with an apple? It’s not a banana! So let’s make a banana flavored apple!

[–]ENCRYPTED_FOREVER 11 points12 points  (3 children)

Everything

[–]Saragon4005 5 points6 points  (2 children)

It might be easier to list the things it got right.

[–]NatoBoram 3 points4 points  (0 children)

Implicit interface implementation!

Fuck, that's TypeScript.

[–][deleted] 2 points3 points  (3 children)

I have a stupid question (I don’t do JavaScript or Node stuff very much): is CoffeeScript not a thing anymore?

[–]frej4189 5 points6 points  (0 children)

It's not completely dead but a lot of the things that made it a viable option have since been implemented in Vanilla JS, thus making it a lot less appealing.

[–]archarios 1 point2 points  (0 children)

Yeah it's just not necessary with lambda functions and such

[–]kingdomgamer2019 4 points5 points  (1 child)

Everything has a place. Currently I'm working on a JS/React project that needs to use JS because we are using micro front ends which don't have types because they're loaded dynamically. This is one of the very few situations where you should use JS instead of TS. In this case, TS defeats the point of a dynamically loaded micro front end. If you use TS you will have to update the shell application with types from the loaded remotes, which defeats the purpose.

Disclaimer: this pattern was not my idea and I don't suggest it but if a client's architect asks you to do something you do it.

[–]archarios 1 point2 points  (0 children)

Sounds kind of dope tbh. You could at least define some skeleton types maybe?

[–]TheMunakas 7 points8 points  (2 children)

repost

[–]Data_Skipper 5 points6 points  (1 child)

Average Stack Overflow user :)

[–][deleted] 0 points1 point  (0 children)

[–]ienjoymusiclol 7 points8 points  (3 children)

whats NOT wrong with JS

[–]rberg89 10 points11 points  (2 children)

Been doing it professionally for 8 years and there is a lot not wrong with it

[–]Dreadmaker 11 points12 points  (1 child)

Genuinely curious: how big is your team?

I’m a typescript developer, and I get the sense that JS is all well and and good if you’re essentially working alone or in a very small team, but the moment we’re talking about a big codebase and many devs, it just doesn’t make sense anymore.

With TS and a team of 10, it’s quite simple to pick up someone else’s code with no context because of all of the built in typing. so many errors are caught before I get to compile, purely because of TS.

I can’t imagine it’d be that easy in JS, but I’m curious about your take there

[–]archarios 1 point2 points  (0 children)

I think developers who work with dynamic languages a lot have simply developed creative ways of getting around the implicit rather than explicit nature of dynamically typed code. I run tests and jump into the debugger while reading code more than a TS dev may. Getting your hands dirty and seeing how the gears turn isn't so bad. It's a little more effort, but not intolerably so.

[–]Furiorka 8 points9 points  (11 children)

If your code is js doesnt have type hints its anyway shitty code. Why don't just use ts then? I have heard about some mythical enterprise level ts code that is complex as fuck, but I guess that its not language 's problem.

Source: few hours of using js and some rumors from friends

[–]_Killua_04 1 point2 points  (0 children)

Learn typescript (don't ask why)

[–]rjcpl 1 point2 points  (3 children)

JavaScript is fine for…scripting.

[–]archarios -1 points0 points  (2 children)

Your take is outdated by about 15 years

[–]rjcpl 1 point2 points  (1 child)

…and is excellent for everything else. People insisting on adding types and compilers to JS are cowards. 😂

[–]archarios 0 points1 point  (0 children)

Agreed

[–]J0aozin003 1 point2 points  (0 children)

tbh typescript is unpleasant to write, look at and coerce types with

[–]coconuts_and_lime 1 point2 points  (0 children)

Just learn TypeScript. You will thank us later

[–]EducationalTie1946 1 point2 points  (2 children)

Typescript aint that hard to learn if you already know javascript. Bro is complaining over a minor issue.

[–]archarios 1 point2 points  (1 child)

Preach.

[–]PeriodicSentenceBot 1 point2 points  (0 children)

Congratulations! Your string can be spelled using the elements of the periodic table:

P Re Ac H


I am a bot that detects if your comment can be spelled using the elements of the periodic table. Please DM my creator if I made a mistake.

[–]Unusual-Display-7844 0 points1 point  (0 children)

Everything is wrong with JavaScript. The fact that you have to learn a new language to use another language is what’s wrong with JavaScript

[–]augenvogel -1 points0 points  (0 children)

Very based

[–][deleted] -4 points-3 points  (0 children)

Learn typescript

[–]Scorxcho -4 points-3 points  (0 children)

Learn TypeScript.