• zagaberoo@sopuli.xyz
    link
    fedilink
    arrow-up
    0
    ·
    2 days ago

    The risk is when it happens unintentionally. The language is bad for hiding such errors by being overly ‘helpful’ in assuming intent.

        • FooBarrington@lemmy.world
          link
          fedilink
          arrow-up
          0
          ·
          2 days ago

          Not really, considering Typescript only adds static types to JS. It’s not a different language, it’s an extension.

          • Quibblekrust@thelemmy.club
            link
            fedilink
            English
            arrow-up
            0
            ·
            2 days ago

            Since it needs to be compiled to JavaScript in order to be used, I kind of consider it a different language. Yes, it’s a strict superset of JavaScript, but that makes it different.

            • FooBarrington@lemmy.world
              link
              fedilink
              arrow-up
              0
              ·
              edit-2
              2 days ago

              That’s your prerogative, but it honestly doesn’t make sense. Typescript adds almost no functionality to JS (and the few pieces it adds are now considered mistakes that shouldn’t be used anymore). It only focuses on adding typing information, and in the future you’ll be able to run TS that doesn’t use those few added features as JS (see the proposal).

              You can also add the TS types as comments in your JS code, which IMO shows that it’s not a different language.