• shalafi@lemmy.world
    link
    fedilink
    English
    arrow-up
    4
    ·
    20 hours ago

    Somebody clue me in on Typescript. I’m somewhat familiar with scripting, PowerShell guy here.

    • Feyd@programming.dev
      link
      fedilink
      arrow-up
      11
      ·
      18 hours ago

      Is JavaScript plus static type checking and a few other syntax enhancements. It is much easier to maintain software with static type checking. The typescript compiler outputs JavaScript

    • mercano@lemmy.world
      link
      fedilink
      arrow-up
      7
      ·
      18 hours ago

      It’s a superset of JavaScript. The big add is static typing, reducing the chance of runtime type errors. It compiles to vanilla JavaScript for distribution. Other new features include enums, interfaces, and generics for more type safety.

      • humorlessrepost@lemmy.world
        link
        fedilink
        English
        arrow-up
        1
        ·
        4 hours ago

        Genuine question: is it really a superset if it’s not still valid javascript? Isn’t it more of an abstraction layer on top of javascript?

        • CookieOfFortune@lemmy.world
          link
          fedilink
          arrow-up
          1
          ·
          2 hours ago

          In practice people don’t use Typescript as a superset since they have stricter compiler settings, which would make valid JavaScript fail to compile.

        • mercano@lemmy.world
          link
          fedilink
          arrow-up
          2
          ·
          3 hours ago

          Superset means all valid JavaScript is also valid Typescript. (At least, so long as you don’t have compiler setting on that requires all variables to have a type declared.)

    • AugustWest@lemmy.world
      link
      fedilink
      arrow-up
      5
      ·
      edit-2
      18 hours ago

      It’s basically just a programming language based on and inclusive of JavaScript, but with extra features.