nickarthur
4/29/2018 - 3:46 AM

Typescript setup in VSCode

Typescript setup in VSCode

{
    "compilerOptions": {
        "target": "es5",
        "module": "commonjs",
        "sourceMap": true
    },
    "exclude": [
        "node_modules"
    ]
}
class Startup {
    public static main(): number {
        console.log('Hello World');
        return 0;
    }
}

Startup.main();

Jay's Typescript Setup Notes

In Terminal

Add typescript globally to to my computer

npm install -g typescript

Check to make sure it worked

tsc --version
tsc --help

Setup a simple example

First create a simple config file to build from the typescript files

  • see attached tsconfig.json

Create helloworld file in typescript

  • see attached helloworld.ts

Build in VSCode with tsconfig.json

  • see that it produced a helloworld.js file
  • see that it produced a helloworld.js.map file

Run in terminal to make sure it spits out 'Hello World'

type this in

node helloworld.js

Voila!