I was talking to my manager the other day, discussing the languages we are using at $dayjob. He kind of offhandedly said that he thinks TypeScript is a temporary fad and soon everything will go back to using JavaScript. He doesn’t like that it’s made by Microsoft either.

I’m not a frontend developer so I don’t really know, but my general impression is that everything is moving more and more towards TypeScript, not away from it. But maybe I’m wrong?

Does anyone who actually works with TypeScript have any impression about this?

  • Vincent@feddit.nl
    link
    fedilink
    arrow-up
    140
    ·
    6 months ago

    If TypeScript still is a fad at this point, his definition of fad is far lengthier than mine is.

    I’m fairly sure TypeScript will remain in popular use longer than whatever project you’re working on 😅

  • hperrin@lemmy.world
    link
    fedilink
    arrow-up
    55
    ·
    6 months ago

    TypeScript might not be here to stay, but typed JavaScript definitely is. I’ve switched to writing 100% TypeScript, and haven’t looked back. The fact that just adding types to one of my (admittedly more complex) libraries surfaced 3 unknown bugs was eye opening to me.

  • redcalcium@lemmy.institute
    link
    fedilink
    arrow-up
    49
    arrow-down
    2
    ·
    6 months ago

    CoffeeScript was a fad, but TypeScript seems to gaining more and more popularity these days, with new runtimes like deno supporting them natively. TypeScript finally gave Microsoft relevancy again in webdev world, so I bet they’ll go a great length to make sure it stays that way. If Microsoft were still making their own browser engine, I bet they’ll make it natively supports TypeScript too.

    • magic_lobster_party@kbin.run
      link
      fedilink
      arrow-up
      41
      arrow-down
      1
      ·
      6 months ago

      CoffeeScript was a fad because it didn’t solve anyone’s problems. It was basically “look how cool code you can write”.

      TypeScript is gaining popularity because static typing solves real problems. It’s also a superset of JavaScript instead of being a completely new language from scratch, which makes it easier for JavaScript devs to learn.

      • brian@programming.dev
        link
        fedilink
        arrow-up
        18
        ·
        6 months ago

        it felt to me like coffeescript solved problems that people had, then js got equivalent features. arguably that could happen to ts as well

        • Bourff@lemmy.world
          link
          fedilink
          arrow-up
          9
          ·
          6 months ago

          Exactly, it was pretty useful until ~2015 imho. Then JS got better, and coffeescript did not follow these evolutions.

    • Eager Eagle@lemmy.world
      link
      fedilink
      English
      arrow-up
      14
      arrow-down
      1
      ·
      edit-2
      6 months ago

      CoffeeScript wasn’t a fad, it just became obsolete because JS adopted the syntax sugar CoffeeScript was selling. In a way, it did its job.

      • flying_sheep@lemmy.ml
        link
        fedilink
        arrow-up
        7
        ·
        6 months ago

        Yup! All of the following features were in CoffeeScript first: Modules, classes, arrow functions, async functions, parameter defaults, …spread, destructuring, template strings.

        So I’d say it was extremely successful in making JavaScript better.

  • shnizmuffin@lemmy.inbutts.lol
    link
    fedilink
    English
    arrow-up
    38
    ·
    6 months ago

    A fad? No, definitely not. TypeScript brings features (and structure) that will /should probably make their way into JS.

    It’s sort of like asking, “does SASS replace CSS” or “is liquid the next HTML?” They’re just implementations of features FE developers want in the core spec of JS, CSS, and HTML.

    • Vincent@feddit.nl
      link
      fedilink
      arrow-up
      18
      arrow-down
      1
      ·
      6 months ago

      that will /should probably make their way into JS.

      Not really, IMHO. The main advantage of TS is that it will help you catch errors without having to run a particular piece of code - i.e. you won’t have to move to the third page of some multi-page form to discover a particular bug. In other words, it helps you catch bugs before your code even reaches your browser, so it doesn’t bring you much to have them in the browser.

      (There is a proposal to allow running TS in the browser, which would be nice, but you’d still run a type checker separately to actually catch the bugs.)

      • 56!@lemmy.ml
        link
        fedilink
        arrow-up
        5
        ·
        6 months ago

        I think the important part is that the syntax will become standardised, rather than being defined by microsoft/typescript, potentially allowing for alternative implementations. It could also make the build step optional in some cases, which is something people dislike about typescript currently.

        • Vincent@feddit.nl
          link
          fedilink
          arrow-up
          1
          ·
          6 months ago

          I think the syntax explicitly won’t get standardised - but the places where syntax can be put will be (e.g. after a : following a variable, before the =). With, yes, the goal of eliminating the build step, but the type checker (which really is just a linter at this point) would still be able to define their own specific syntax. I don’t think it could work any other way either, anyway.

    • BrianTheeBiscuiteer@lemmy.world
      link
      fedilink
      arrow-up
      6
      ·
      6 months ago

      Hoping this is true. The biggest annoyance with typescript is needing some kind of compiler. Haven’t used Bun or Deno very much, both of which natively support TS, but there are still incompatibilities with the way Node does things and how certain modules were built (CommonJS vs ESM). I like writing JavaScript but the tooling is utter crap.

  • locke@sopuli.xyz
    link
    fedilink
    arrow-up
    35
    arrow-down
    1
    ·
    edit-2
    6 months ago

    Typescript makes writing Javascript a reasonable thing to do. Your manager is a fad.

  • porgamrer@programming.dev
    link
    fedilink
    arrow-up
    34
    arrow-down
    1
    ·
    6 months ago

    5 years ago everything was moving to TypeScript. Now everything has moved. Developers are still catching up, but it will be one-way traffic from here.

    I’m guessing your manager thinks TypeScript is like CoffeeScript. It is not like CoffeeScript.

    Also, TypeScript is only the beginning. In the halls of the tech giants most devs view TypeScript as a sticking plaster until things can be moved to webassembly. It will be a long time until that makes any dent in JS, but it will also be one-way traffic when it does.

    • aidan@lemmy.world
      link
      fedilink
      arrow-up
      1
      ·
      6 months ago

      Developers are still catching up, but it will be one-way traffic from here.

      Honestly I disagree, maybe I exist in a bit of an echo chamber, but it seems like since around ES2020 or so (some) people have been transitioning from TS to write JS with JSDoc and modern JS style rules.

      I’ve basically transitioned to Go for work(where I can), but don’t really mind writing modern JS

  • Lmaydev@programming.dev
    link
    fedilink
    arrow-up
    28
    arrow-down
    2
    ·
    6 months ago

    When anyone in a professional setting says they don’t like having a mega corp supporting something I lose a bit of respect for their opinion tbh.

    Yes we all know mega corps suck.

    But if you’re using anything in a professional production environment that is meant to last in the long term this is 100% what you want.

    • Valmond@lemmy.world
      link
      fedilink
      arrow-up
      6
      ·
      6 months ago

      Some of us are old enough to remember the browser wars and EEE, so I definitely understands not wanting to be sucked into some mega corps eco system with future lock-ins. Often you can’t do anyhhing else, but that doesn’t mean it doesn’t suck.

      • Lmaydev@programming.dev
        link
        fedilink
        arrow-up
        1
        ·
        6 months ago

        Same. Writing sites that relied on IE was always a stupid decision and kinda invalidated the point of writing a web app.

        I think most people knew that and the managers fucked up big time pushing it. At least in my experience.

        But that’s very different to choosing a programming language.

    • aidan@lemmy.world
      link
      fedilink
      arrow-up
      1
      ·
      6 months ago

      I mean it is fair to say sometimes it depends on the mega corp, if the whole thing relies on one corp if they’re funding dries up then the whole project dies. But I also don’t really think typescript would die without Microsoft now

  • expr@programming.dev
    link
    fedilink
    arrow-up
    27
    arrow-down
    3
    ·
    6 months ago

    No, because raw-dogging JavaScript isn’t something grown-up software shops do.

  • RonSijm@programming.dev
    link
    fedilink
    arrow-up
    22
    ·
    edit-2
    6 months ago

    Javascript is a fad, we should all move to WASM. 🙃

    But no, TypeScript is not a fad. Unless a better “Typescript like” thing comes out - I know how in frontend land people like to make their own substitute framework that does something slightly different than an existing framework - But I don’t really see why anyone would want to make a NewTypeScript, and not just expand existing TypeScript

  • nick@campfyre.nickwebster.dev
    link
    fedilink
    English
    arrow-up
    23
    arrow-down
    1
    ·
    edit-2
    6 months ago

    Hi, I’ve been doing TypeScript in my day-job and hobbies for six and a bit years now. I would not write JS in any other way.

    TS is also a superset of JS so all JS is valid (unless you turn on strict mode). So there is no productivity loss/learning curve unless you want there to be.

    In fact, a lot of people who think they’re not using typescript are using it because their editors use typescript definitions for autocomplete and JSDoc type signatures are powered by typescript.

    • aidan@lemmy.world
      link
      fedilink
      arrow-up
      2
      ·
      6 months ago

      So there is no productivity loss/learning curve unless you want there to be.

      It’s not significant but an extra build step can be annoying

  • Zannsolo@lemmy.world
    link
    fedilink
    arrow-up
    21
    arrow-down
    1
    ·
    6 months ago

    I’ll riot if I ever need to write pure js again. 98% of web devs would be better served writing in TS. If you’re actually knowledgeable enough to write more efficient js, more power to you but honestly I was probably being generous saying 2% of web devs fall into that category.

    • shastaxc@lemm.ee
      link
      fedilink
      arrow-up
      2
      ·
      6 months ago

      Even then, it just leaves behind an illegible mess that the next dev has to gut and replace with typescript later. If someone wants to use JS on their hobby project, go for it. The extra tools that types enable are super valuable for a team.

  • TCB13@lemmy.world
    link
    fedilink
    English
    arrow-up
    20
    arrow-down
    1
    ·
    edit-2
    6 months ago

    I believe both are true… and I also develop a LOT in Angular (with TypeScript).

    TypeScript is great but the thing is that if you look at the history of TypeScript and JS/ECMAScript you’ll find out that TypeScript sometimes is the testing ground for the future features of ECMAScript - pretty much like what happens with Sass and CSS that how even has nesting and scopes.

    The issue with TypeScript/Sass etc. is that it requires a compiler and that’s totally obnoxious and completely defeats the point of having interpreted code on browsers. Depending on the project it might be better to go for TypeScript + Angular/React or other compiled solution or simply something vanilla with jQuery or the Vue runtime (no compilation) and other libraries.

    If TypeScript ever goes away the underlaying features that make it great will be implemented in ECMAScript in the same way that we got modules, classes etc. and I really hope it happens. Less compilation usually equals code more maintainable in the long run because you won’t require hundreds of dependencies (that will eventually break) to get it to compile.

    • Vincent@feddit.nl
      link
      fedilink
      arrow-up
      4
      ·
      6 months ago

      TypeScript sometimes is the testing ground for the future features of ECMAScript

      They have an explicit policy to only include features that are stage 3 already (i.e. that are pretty much certain to land in the language as-is). The only times they’ve diverged from this is long in the past (I think enum is the main remnant of that, for which I’d recommend using unions of literal string types instead), and experimentalDecorators under pressure from Angular - which has always been behind a flag explicitly named experimental.

      So I really wouldn’t worry too much about that.

    • SorteKanin@feddit.dkOP
      link
      fedilink
      arrow-up
      5
      arrow-down
      2
      ·
      6 months ago

      The issue with TypeScript/Sass etc. is that it requires a compiler and that’s totally obnoxious and completely defeats the point of having interpreted code on browsers.

      Shouldn’t WebAssembly be a solution to this? I.e. so you don’t have to interpret code but rather run the wasm binary (which is kinda interpretation as well but you get what I mean).

      • redcalcium@lemmy.institute
        link
        fedilink
        arrow-up
        6
        arrow-down
        1
        ·
        6 months ago

        I love seeing webassembly getting traction because it enable cool stuff never thought possible before running in web browsers. But webassembly is a blackbox that can’t be tinkered with by end users. I dread the day webassembly become so widely used that average websites run under webassembly because that would be the end of blocking ads or tweaking websites behavior with greasemonkey scripts.

        • SorteKanin@feddit.dkOP
          link
          fedilink
          arrow-up
          10
          ·
          6 months ago

          I don’t think adblockers rely on interpreting JavaScript, I think they would still work even if a site used WebAssembly.

          Source: I can assure you every single ad-funded website would be doing this if that was the case.

          • redcalcium@lemmy.institute
            link
            fedilink
            arrow-up
            6
            ·
            edit-2
            6 months ago

            ublock origin won’t help you blocking the ad elements if the entire website ui is rendered in a canvas (already starting to happen thanks to some frameworks like flutter) and can’t block the ad logic if it bundled in the wasm along with the rest of the app. It might still able to block the requests, but they’re starting to serve the ads from the same domain that serves the website so it can’t be blocked without breaking the website itself, and might begin to serve those over websocket so adblockers can’t block it by url path. With javascript, an ad blocker might still be able to monkey patch the ad logic on runtime to break it, but with black box like wasm I’m not sure if such thing is possible.

            Once tooling and frameworks make it easier for average webdevs to use webasm, I’m sure ad companies will begin to offer it in their ads sdk. Thankfully most websites with ads are still care about SEO so at the very least we can be sure it won’t happen anytime soon, unless something changes in how google works that could enable this.

            • shnizmuffin@lemmy.inbutts.lol
              link
              fedilink
              English
              arrow-up
              3
              ·
              6 months ago

              the entire website ui is rendered in a canvas (already starting to happen thanks to some frameworks like flutter)

              That sounds like an accessibility nightmare.

              • redcalcium@lemmy.institute
                link
                fedilink
                arrow-up
                3
                ·
                6 months ago

                Have you tried not being disabled?

                Flutter devs actually defended this approach, saying the web in general is moving to this direction. I think they’ve mellowed out somewhat and released html renderer support, though it’s still default to canvas for desktop web browsers.

      • TCB13@lemmy.world
        link
        fedilink
        English
        arrow-up
        1
        ·
        6 months ago

        That’s not a solution, it is the exact opposite - adding even more compilation and complexity to things. The ideia is to move away from compiled stuff as much as possible. WebAssembly makes sense for very complex and low level stuff that you can’t run interpreted with reasonable performance.

        Less compilation usually equals code more maintainable in the long run. Think about it: if you don’t need a compiler and the hundreds of dependencies that will eventually break things will last way more time. Websites from the 90’s still work fine on modern browsers and you can update them easily while compiled stuff is game over once you lose the ability to install run said compiler and related dependencies.

        • SorteKanin@feddit.dkOP
          link
          fedilink
          arrow-up
          1
          ·
          6 months ago

          Think about it: if you don’t need a compiler and the hundreds of dependencies that will eventually break things will last way more time.

          You can have hundreds of dependencies whether you use a compiled or interpreted language, that really has nothing to do with that.

          Also compilation has lots of benefits, including being able to do lots of static analysis to find bugs. I definitely don’t agree that we should move away from compilation in general or WebAssembly specifically. WebAssembly doesn’t have to be only used for low level stuff, you can write your code in a high level language and compile to WebAssembly just fine.

  • treechicken@lemmy.world
    link
    fedilink
    arrow-up
    19
    ·
    edit-2
    6 months ago

    I hope not. I’m pretty sure me and my coworkers would be at each others’ throats if it were not for some form of typed JS holding our Frankenstein codebase together.

  • TehPers@beehaw.org
    link
    fedilink
    English
    arrow-up
    17
    ·
    6 months ago

    Imagine changing your file extension from .js to .ts and calling it a fad. JS is TS. The difference is that TS does more (by actually doing stuff before runtime as a static analyzer, similar to eslint). If TS is a fad, then modern web dev is a fad.

    Which, to be fair, it is.