• bleistift2@sopuli.xyz
    link
    fedilink
    English
    arrow-up
    93
    arrow-down
    2
    ·
    21 hours 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
    35
    ·
    21 hours 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
      40
      ·
      20 hours 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
        2
        ·
        11 hours 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.

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

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

    • Feyd@programming.dev
      link
      fedilink
      arrow-up
      10
      ·
      14 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
      ·
      14 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.

    • AugustWest@lemmy.world
      link
      fedilink
      arrow-up
      5
      ·
      14 hours ago

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