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?

    • Cyclohexane
      link
      fedilink
      arrow-up
      2
      ·
      9 months ago

      I won’t remember everything, but one very important things comes to mind:

      in Typescript, it is very difficult to assert on a type (let me know if you’re not familiar with what I mean by this and I can explain further). In OCaml, this is trivial using pattern matching.

      Why would you need that? The idea of a type system is it doesn’t let you apply a function on a structure without the structure being of the right type. But the lack of type assertion in TS makes people follow hacky workarounds, which defeat the purpose of type system.

      There are a couple of other things, like immutable types by default, automatic tail call optimization, functors enabling higher kinded types, etc.

      Also in ocaml, you don’t have to annotate any types on any variable or parameter, and you’ll still get full type protection.

      • laughterlaughter@lemmy.world
        link
        fedilink
        arrow-up
        1
        ·
        edit-2
        9 months ago

        Oh, so what you’re describing is strong typing. I thought it was a unique feature of Ocaml. But in reality, any strong-typed language will have this as well.

        And yeah, Typescript merely “suggests” typing, and it will allow you to build the project even if you ignore the type errors. A build system refusing to, well, build, if there are typing errors usually takes care of this, but again, the dev team may as well not implement this.