• Gecko@lemmy.world
    link
    fedilink
    English
    arrow-up
    18
    arrow-down
    1
    ·
    1 year ago

    Type error unless there’s an implementation of + that specifies adding together and integer and a string.

    • jdeath@lemm.ee
      link
      fedilink
      English
      arrow-up
      11
      arrow-down
      1
      ·
      1 year ago

      💯% accurate. funny how the typescript developer thinks this is some kind of “gotcha!”… like maybe just try a language besides typescript and find out for yourself 😆

      • tgv@programming.dev
        link
        fedilink
        English
        arrow-up
        1
        arrow-down
        1
        ·
        1 year ago

        That’s such a weird take. Who cares what another language does? Your complaint was about typescript. Which lets the programmer decide what this should be. As you could have known.

        But most likely it was just trolling. On the plus side, at least now I know that the rigid minded devs came here too, and took their righteousness with them.

        • jdeath@lemm.ee
          link
          fedilink
          English
          arrow-up
          1
          ·
          1 year ago

          my complaint is that typescript is stupid, yes. so why wouldn’t i compare to what other languages do that is less stupid?

          on the plus side, at least now i know that the ad-hominem minded devs came here too, and brought their righteousness with them.

          • tgv@programming.dev
            link
            fedilink
            English
            arrow-up
            1
            arrow-down
            1
            ·
            1 year ago

            Yeah, you’re right. Lemmy is reddit, but worse, and very small. I have no doubt your contributions will keep it that way. I’m going to delete my account. This is just not worth anybody’s time and attention.

    • nyan@lemmy.cafe
      link
      fedilink
      English
      arrow-up
      2
      arrow-down
      2
      ·
      1 year ago

      Exactly. Most languages I know of that allow this at all will coerce the “1” to an integer and give x = 2. They get away with this because they define the “+” operator as taking numbers only as arguments, so if you hand them x = x + "cheese" they’ll error out.