Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?

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