Skip to content
DevMeme
3927 of 7590
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.

Comments

60
Anonymous ★ Top Pick JavaScript did not disappear; it just got a type annotation and a lifelong fear of `any`.
  1. Anonymous ★ Top Pick

    JavaScript did not disappear; it just got a type annotation and a lifelong fear of `any`.

  2. @germanmetall 4y

    let...

  3. @VladislavSmolyanoy 4y

    strong types > weak types that’s not on opinion, that’s the truth

    1. @realVitShadyTV 4y

      Strong types for virgins who don’t sure about their data flow. True chads knows what they pass and receive.

      1. @chupasaurus 4y

        https://github.com/minimaxir/big-list-of-naughty-strings

      2. @VladislavSmolyanoy 4y

        Fair enough. Your opinion is still wrong

    2. @ixplo 4y

      sure, but ts is more expensive, and has readability problems. so 1:1

      1. @VladislavSmolyanoy 4y

        What readability problems?

        1. @ixplo 4y

          random example from react-router. looks like zip-archive opened in notepad

          1. @Box_of_the_Fox 4y

            React is so fucked and broken that even ts can't help

            1. @ixplo 4y

              vue-router TS :)

  4. @saidov 4y

    "as any" for help

  5. @Box_of_the_Fox 4y

    And do not try to use ts in react-native

  6. @Box_of_the_Fox 4y

    Just don't

  7. @Box_of_the_Fox 4y

    It's absolute hell

  8. @Box_of_the_Fox 4y

    To get routing working you need to do type to type to type

  9. @Box_of_the_Fox 4y

    Like

  10. @Box_of_the_Fox 4y

    What the fuck happened there

  11. @ixplo 4y

    I think that there is only one reason why TS is so popular. Bad coders are trying to look like a good ones

    1. @Box_of_the_Fox 4y

      TS is great. React just sucks

      1. @ixplo 4y

        what does ts give you. number-string errors protection and slightly better code-autocompletion? what it great for?

        1. @Box_of_the_Fox 4y

          Hints in IDEs that work

  12. @ixplo 4y

    :)

  13. @Box_of_the_Fox 4y

    Also if you are unfortunate working on spaghetti it sometimes helps figure out were some objects are created

  14. @ixplo 4y

    sometimes... but you have to maintain ts constantly for such benefits

    1. @Box_of_the_Fox 4y

      If you don't maintain your code then lack of types will make your life even worse

  15. @ixplo 4y

    and like I sad ts coders and development process are more expensive :(

  16. @Box_of_the_Fox 4y

    Random garbage data going around without any idea what is what

    1. @GenerauKowalski 4y

      Exactly

  17. @ixplo 4y

    the longest string from image could look like that in js (to, from, next) => {}

  18. @ixplo 4y

    that was about TS readability issues question

  19. @tsstgm 4y

    Or type naming

  20. @ixplo 4y

    readable names are must in good code

    1. @RiedleroD 4y

      C: uint8_t Rust: u8 Java: straight up doesn't have that type

      1. @ixplo 4y

        didn't get it. Are these built in types?

        1. @RiedleroD 4y

          it's the names for unsigned 8-bit Integer types

          1. @ixplo 4y

            it's ok for built in types

            1. @RiedleroD 4y

              I was making fun of Java here

      2. @LonelyGayTiger 4y

        You clearly have 0 understanding of java. It's called a byte.

        1. @RiedleroD 4y

          those are signed afaik

          1. @LonelyGayTiger 4y

            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.

            1. @RiedleroD 4y

              yeah, I get it. Working with C++, rust, python, Java, and sometimes even js in the same week is confusing me too sometimes.

              1. @LonelyGayTiger 4y

                Yeah. At home I'm working with primarily C++ and Java, mostly powershell and js at work.

  21. @ixplo 4y

    I'm talking about user created vars and types like mainHeaderNavigationAccessRules :)

    1. @newmankrr 4y

      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

      1. @ixplo 4y

        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

        1. @newmankrr 4y

          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)

          1. @ixplo 4y

            I think you wrong because ts doesn't check types in runtime. And we shouldn't do that in js

            1. @newmankrr 4y

              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

            2. @newmankrr 4y

              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

              1. @ixplo 4y

                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.

    2. @ixplo 4y

      it was example of pretty good name

  22. @VladislavSmolyanoy 4y

    Don’t care about your arguments. Strong types > weak types

  23. @ixplo 4y

    :D

  24. @ixplo 4y

    np

  25. @ixplo 4y

    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

  26. @ixplo 4y

    but maybe it was just a bad example. And yes, I know that TS is for error prevention. It's obviously

  27. @ixplo 4y

    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

  28. @jhintux 4y

    Js is a mistake yet we have to use it 😗🖖

  29. @azizhakberdiev 4y

    To code in js you should think as js

Use J and K for navigation