I don\'t want to use grunt or gulp to compile ts files. I just want to do it in my package.json something like this:
\"scripts\": {
\"build\": \"tsc ma
If you want to compile and run, you can use the ts-node module.
npm install --save-dev ts-node
npm install --save-dev typescript
And run with:
"scripts": {
"start": "ts-node index.ts"
},
All other typescripts files that index.ts has imported (along with imports from index.ts dependencies) will be compiled and executed.
"build": "tsc main.ts dist/"
Highly recommend you use tsconfig.json
and then the -p
compiler option to build your code.
Look at: Compilation-Context
Here is the setup for using tsc
with NPM scripts
init
npm init
npm install typescript --save
And then in your package.json add some scripts:
"scripts": {
"build": "tsc -p ./src",
"start": "npm run build -- -w"
},
npm run build
npm start
Enjoy