Skip to main content

Env Setup

TSC Compiler installation

The typescript compiler namded tsc which built in the typescript NPM package

npm install typescript

# or use yarn
yarn add -D typescript

Then run it manually

./node_modules/typescript/bin/tsc example.ts

# or use yarn, to prevent running code which haven't installed
yarn tsc example.ts

Or make tsc watch the changes from folder

yarn tsc -w

Initiala a TS Project

Simplely run tsc --init to generate the base structure of tsconfig.json for your project

tsc --init

And the settings in tsconfig.json you would like to change after project initialed

{
"rootDir": "./src", /* Specify the root folder within your source files. */
"outDir": "./build", /* Specify an output folder for all emitted files. */
}