Languages
Post #4274 · source on Telegram
TypeScript Makes JavaScript Grow Up
Description
The meme uses a three-panel emotional movie scene of a father figure comforting a young boy outdoors. The top panel text says "VAR X?", the middle says "NO SON, YOU HAVE TO USE VAR X:STRING NOW", and the bottom says "IT'S OK, EVERYONE'S MOVING TO TYPESCRIPT NOW. I MISS JS TOO". The joke frames the migration from loose JavaScript declarations to TypeScript-style type annotations as a childhood loss. It is really about the industry's shift from dynamic scripting convenience toward static typing, type safety, and compile-time checks in large JavaScript codebases.
Use J and K for navigation
Comments
60Comment deleted
JavaScript did not disappear; it just got a type annotation and a lifelong fear of `any`.
let... Comment deleted
strong types > weak types that’s not on opinion, that’s the truth Comment deleted
Strong types for virgins who don’t sure about their data flow. True chads knows what they pass and receive. Comment deleted
https://github.com/minimaxir/big-list-of-naughty-strings Comment deleted
Fair enough. Your opinion is still wrong Comment deleted
sure, but ts is more expensive, and has readability problems. so 1:1 Comment deleted
What readability problems? Comment deleted
random example from react-router. looks like zip-archive opened in notepad Comment deleted
React is so fucked and broken that even ts can't help Comment deleted
vue-router TS :) Comment deleted
"as any" for help Comment deleted
And do not try to use ts in react-native Comment deleted
Just don't Comment deleted
It's absolute hell Comment deleted
To get routing working you need to do type to type to type Comment deleted
Like Comment deleted
What the fuck happened there Comment deleted
I think that there is only one reason why TS is so popular. Bad coders are trying to look like a good ones Comment deleted
TS is great. React just sucks Comment deleted
what does ts give you. number-string errors protection and slightly better code-autocompletion? what it great for? Comment deleted
Hints in IDEs that work Comment deleted
:) Comment deleted
Also if you are unfortunate working on spaghetti it sometimes helps figure out were some objects are created Comment deleted
sometimes... but you have to maintain ts constantly for such benefits Comment deleted
If you don't maintain your code then lack of types will make your life even worse Comment deleted
and like I sad ts coders and development process are more expensive :( Comment deleted
Random garbage data going around without any idea what is what Comment deleted
Exactly Comment deleted
the longest string from image could look like that in js (to, from, next) => {} Comment deleted
that was about TS readability issues question Comment deleted
Or type naming Comment deleted
readable names are must in good code Comment deleted
C: uint8_t Rust: u8 Java: straight up doesn't have that type Comment deleted
didn't get it. Are these built in types? Comment deleted
it's the names for unsigned 8-bit Integer types Comment deleted
it's ok for built in types Comment deleted
I was making fun of Java here Comment deleted
You clearly have 0 understanding of java. It's called a byte. Comment deleted
those are signed afaik Comment deleted
Weird. You might be right there. I was sure they weren't. This is the problem with working with so many different lanugages on a day to day basis. Easy to get things mixed up. My apologies for the mix up. Comment deleted
yeah, I get it. Working with C++, rust, python, Java, and sometimes even js in the same week is confusing me too sometimes. Comment deleted
Yeah. At home I'm working with primarily C++ and Java, mostly powershell and js at work. Comment deleted
I'm talking about user created vars and types like mainHeaderNavigationAccessRules :) Comment deleted
Go ahead, abbreviate it and expect someone else to understand what that variable means later. You call lack of readability having long names, (and if you can write a shorter/better version of it, ofc it's better to keep the shorter, that's not always the case) but in my opinion it's better describe what exactly that does than having it be miss-used somewhere. You do you, tho Comment deleted
nono long names is a good idea. in js we barely have enough space for them. But TS leaves us no chance. And we are getting code from my pics above Comment deleted
Correct me if I'm wrong, but isn't that code on the pic from the source code of the library? Unless you are willing to contribute to the lib, I don't think there's a problem with that. Their code tends to be more difficult to read, since they are abstracting some concepts, but it's better to type it like that, than having to write a thousand if statements on each function just to check if the parameters have the correct type (which is what happens in js) Comment deleted
I think you wrong because ts doesn't check types in runtime. And we shouldn't do that in js Comment deleted
I didn't say that ts checks types in runtime. The reason is said that ts prevents some bugs from happening, is exactly because it works on build time, instead of runtime. On js, these bugs that can be prevented on build time with ts, will only be seen when that piece of code is executed Comment deleted
What I was saying was, things like function(x) { if (typeof x !== "function") throw new Error("x type must be function") } that you can find on js libraries, are not needed when using ts Comment deleted
this code is ok only if user or something out of your team can affect argument x. (or when it's right program behavior set by business logic) And TS won't help in this situation. Waiting for probable bad data from other modules is antipattern. Comment deleted
it was example of pretty good name Comment deleted
Don’t care about your arguments. Strong types > weak types Comment deleted
:D Comment deleted
np Comment deleted
TS works only in IDE and at the build time. And it doesn't matter what kind of code we talking about: library or your project code. TS is always less readable. That's the price for type checking in IDE. Yes it can help in difficult situation. But the price is continuous additional work around TS and it's disadvantages Comment deleted
but maybe it was just a bad example. And yes, I know that TS is for error prevention. It's obviously Comment deleted
by the way unit tests prevents such errors. TS becomes more useless with such tests. But people uses both. It's like fashion more, not necessity Comment deleted
Js is a mistake yet we have to use it 😗🖖 Comment deleted
To code in js you should think as js Comment deleted