Using the dev version of TypeScript with Visual Studio Code

 
 
  • Gérald Barré
 

Visual Studio Code, Microsoft's lightweight and multi-platform code editor, allows you to create projects using TypeScript. By default, the last stable version of TypeScript is used to compile the ts files. Since Visual Studio Code is very configurable, it is easy to use another version of the TypeScript compiler, including the dev version (nightly build). Here is the procedure:

  1. Install TypeScript: npm install typescript@next

  2. Open the File / Preferences / User Settings menu (or create the file .vscode\settings.json)

  3. Change the variable typescript.tsdk

    JSON
    {
      "typescript.tsdk": "node_modules/typescript/lib/"
    }
  4. Add the compilation task (CTRL+B)

    JSON
    {
        "version": "0.1.0",
        "command": "tsc",
        "isShellCommand": true,
        "args": ["-w", "-p", "."],
        "showOutput": "silent",
        "isWatching": true,
        "problemMatcher": "$tsc-watch"
    }

Voilà

Do you have a question or a suggestion about this post? Contact me!

Follow me:
Enjoy this blog?Buy Me A Coffee💖 Sponsor on GitHub