nickarthur
4/29/2018 - 3:53 AM

TypeScript Tips & Tricks

TypeScript Tips & Tricks

TypeScript Tips & Tricks


How to setup a workspace for your TypeScript project?

# Go to the root of you project
cd /d/path/to/your/project/directory/

# Put the project under the control of npm
npm init

# Install the "lite-server" package locally
npm install lite-server --save-dev

# Put the project under the control of tsc
tsc --init

# Start the "lite-server"
npm start
# Note that you should add "start" to the "package.json" file like this befor running the "npm start" command
"scripts": {
    "start": "lite-server"
}

# Now, when you want to compile all .ts files, just execute this command
tsc

More inof about Setting Up a Workspace