• Feyd@programming.dev
    link
    fedilink
    arrow-up
    7
    ·
    1 day ago

    TypeScript, for those who aren’t familiar, is a Microsoft rewrite of JavaScript that’s incompatible with basic JavaScript in multiple ways

    Wut

    • kibiz0r@midwest.social
      link
      fedilink
      English
      arrow-up
      7
      ·
      1 day ago

      Yeah, that’s uhh… that’s technically true for very strange and specific definitions of “compatibility”… but it wildly misses the point of TypeScript. Not sure what he was thinking there.

      • Feyd@programming.dev
        link
        fedilink
        arrow-up
        4
        ·
        edit-2
        1 day ago

        Yeah node’s --experimental-strip-types exposes the absurdity immediately. The only incompatibility is that it has type annotations.

        • kibiz0r@midwest.social
          link
          fedilink
          English
          arrow-up
          4
          ·
          1 day ago

          Also, like… the fact that it has a compiler. It’s like saying C is incompatible with assembly because you can’t yeet a .c file at an assembler.

    • Azzu@lemmy.dbzer0.com
      link
      fedilink
      arrow-up
      3
      ·
      edit-2
      1 day ago

      I mean once you write your app in typescript, you can’t “go back” to pure JavaScript, you’ll always have to use the typescript compiler to generate JavaScript (of course you can rewrite it later again, but will take potentially lots of effort). I’m pretty sure that’s what they meant with “incompatible”. You are now locked into M$ ecosystem.

        • Azzu@lemmy.dbzer0.com
          link
          fedilink
          arrow-up
          1
          ·
          edit-2
          10 hours ago

          Sure, but with lots of generated code that’s going to be hard to be human readable and changeable. It’s definitely more work to add a feature to the code generated by the compiler, than to add a feature if the code was initially written in JavaScript.

          • TehPers@beehaw.org
            link
            fedilink
            English
            arrow-up
            1
            ·
            8 hours ago

            By default, doesn’t tsc just output the source TS files with type info stripped? Worst case you run a formatter on that output and you’re done.

            There’s some nonstandard TS features like the iterator shim and decorators and such, but you don’t get those by default from what I remember.

      • Feyd@programming.dev
        link
        fedilink
        arrow-up
        4
        ·
        1 day ago

        You’re being too generous. Calling typescript a rewrite shows the author chose something as an example they clearly don’t understand the first thing about.