mkdir minimal-ts && cd minimal-ts
yarn init --yes
to init project and create a package.jsonyarn add typescript -D
to add thetsc
- 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");
};