Skip to content

Instantly share code, notes, and snippets.

@hughpearse
Created April 14, 2023 11:09
Show Gist options
  • Save hughpearse/744ca7f82e4d79a95c58a38de110a569 to your computer and use it in GitHub Desktop.
Save hughpearse/744ca7f82e4d79a95c58a38de110a569 to your computer and use it in GitHub Desktop.

Hello world in typescript

  1. foo@bar$ npm init -y
  2. foo@bar$ npm install typescript --save-dev
  3. foo@bar$ npm install @types/node --save-dev
  4. foo@bar$ npx tsc --init --rootDir src --outDir build --esModuleInterop --resolveJsonModule --lib es6 --module commonjs --allowJs true --noImplicitAny true
  5. foo@bar$ mkdir src
  6. foo@bar$ echo 'console.log("Hello world!")' > src/index.ts
  7. foo@bar$ npx tsc
  8. foo@bar$ node ./build/index.js
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment