Categories
JavaScript Answers

How to install and run TypeScript locally in npm?

Spread the love

To install and run TypeScript locally in npm, we add a script to run the tsc command.

For instance, in package.json, we write

{
  "name": "foo",
  "scripts": {
    "tsc": "tsc"
  },
  "dependencies": {
    "typescript": "^1.8.10"
  }
}

to add the tsc script which runs the tsc command.

Then we run

npm run tsc 

to install the tsc command.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *