Sometimes, we want to install and run TypeScript locally in npm.
In this article, we’ll look at how to install and run TypeScript locally in npm.
How to install and run TypeScript locally in npm?
To install and run TypeScript locally in npm, we can install the typescript
package as a dev dependency.
To install it, we run
npm i typescript --save-dev
Then we can add the tsc
script into package.json
with
{
"name": "foo",
"scripts": {
"tsc": "tsc"
},
//...
}
And then we can run npm run tsc
to run tsc
in our project.
Conclusion
To install and run TypeScript locally in npm, we can install the typescript
package as a dev dependency.