Skip to content

Instantly share code, notes, and snippets.

@FedericoPonzi
Last active August 20, 2019 08:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save FedericoPonzi/519df99c80458e0d536b7882db1d68e5 to your computer and use it in GitHub Desktop.
Save FedericoPonzi/519df99c80458e0d536b7882db1d68e5 to your computer and use it in GitHub Desktop.
Setup typescript project
#from: https://basarat.gitbooks.io/typescript/docs/quick/nodejs.html
npm init -y
npm install typescript --save-dev
npm install @types/node --save-dev
npx tsc --init --rootDir src --outDir lib --esModuleInterop --resolveJsonModule --lib es6,dom --module commonjs
# Done! use `code .` to fireup visual studio.
npm install ts-node --save-dev
npm install nodemon --save-dev
"scripts": {
"start": "npm run build:live",
"build": "tsc -p .",
"build:live": "nodemon --watch 'src/**/*.ts' --exec 'ts-node' src/index.ts"
},
# npm start and as you edit index.ts it's reloaded.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment