Skip to content

Instantly share code, notes, and snippets.

@mbeaudru
Created May 31, 2021 18:28
Show Gist options
  • Save mbeaudru/24055dd6042e90d95642c5fc48856454 to your computer and use it in GitHub Desktop.
Save mbeaudru/24055dd6042e90d95642c5fc48856454 to your computer and use it in GitHub Desktop.

How to create minimal TypeScript project

  • mkdir minimal-ts && cd minimal-ts
  • yarn init --yes to init project and create a package.json
  • yarn add typescript -D to add the tsc
  • Add tsc script into the package.json
  • yarn tsc --init to generate the tsconfig.json file
  • Created index.ts file with an hello world arrow-function
  • yarn tsc to generate the index.js transpiled file

Input (index.ts):

const helloWorld = () => {
  console.log("hello world");
};

Output (index.js):

"use strict";
var helloWorld = function () {
  console.log("hello world");
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment