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.