• dejected_warp_core@lemmy.world
    link
    fedilink
    arrow-up
    7
    ·
    3 days ago

    make no mistakes

    LOL. I know it’s for a laugh, but you may as well add “pretty please” to that prompt.

    Edit: I wonder if it just hallucinates more convincingly, instead?

  • bleistift2@sopuli.xyz
    link
    fedilink
    English
    arrow-up
    126
    arrow-down
    2
    ·
    5 days ago
    1. Rename every file from *.js to *.ts
    2. Set the compiler options
      {
        "checkJs": false,
        "allowJs": true,
        "noEmitOnError": false, // so the compiler compiles code it can’t prove right yet. Reset this after you’re done migrating
      }
      
    3. Install type packages for dependencies that don’t bring type information out of the box, for instance
      npm i -D @types/d3
      
    4. Add // @ts-nocheck to the beginning of every file.
    5. Go through your project file by file, remove the comment from (4) and add types until the errors are gone. And probably fix some errors along the way.

    Abbreviated from “TypeScript Cookbook” by Stefan Baumgartner.

  • trxxruraxvr@lemmy.world
    link
    fedilink
    arrow-up
    47
    ·
    5 days ago

    This is my colleague and I will have to clean up the crap, because he doesn’t understand what’s in his own commits.

    • abbadon420@sh.itjust.works
      link
      fedilink
      arrow-up
      58
      ·
      5 days ago

      Fire him. I’m a teacher and I’ve got some wonderfull and talented students that can’t find a job because companies are affraid to hire juniors because of idiots like him.

      • trxxruraxvr@lemmy.world
        link
        fedilink
        arrow-up
        10
        ·
        5 days ago

        I’m not his manager. He is a good designer though, so I’m fine as long as he stays with his css and photoshop.

  • sp3ctr4l@lemmy.dbzer0.com
    link
    fedilink
    English
    arrow-up
    6
    ·
    4 days ago

    You know, I tend to at least ask them if they could, or if they would be able to do some code task.

    Of course, I’m running a local LLM, because I’m not a monster.

    Anyway, would you kindly check this codebase for any local/global var declaration or scope conflicts?

  • shalafi@lemmy.world
    link
    fedilink
    English
    arrow-up
    4
    ·
    5 days ago

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

    • Feyd@programming.dev
      link
      fedilink
      arrow-up
      13
      ·
      5 days 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
      8
      ·
      5 days 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
        2
        ·
        4 days 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?

        • mercano@lemmy.world
          link
          fedilink
          arrow-up
          3
          ·
          4 days 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.)

        • CookieOfFortune@lemmy.world
          link
          fedilink
          arrow-up
          1
          ·
          4 days 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.

    • AugustWest@lemmy.world
      link
      fedilink
      arrow-up
      6
      ·
      5 days ago

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

  • grego.sh@programming.dev
    link
    fedilink
    English
    arrow-up
    4
    arrow-down
    5
    ·
    4 days ago

    Laugh all you want, I once made something like that work. Not with one prompt of course. More like two days of prompting, but still… I’m sure if I was doing it by hand it would take me a week of work at least