Packages
- typescript # Type system
- ts-node # Compile and execute TS with one command
- nodemon # Watch files for changes
- concurrently # Run multiple commands in the same line
- ts-node-dev # Nodemon + ts-node in one line
tsc
# Build a .js file from the .ts file
tsc file.ts
# tsc by itself uses the "rootDir" to compile the files. tsc stands for Typescript Compiler
tsc
# Watch for changes
tsc -w
# Get help
tsc --help
ts-node
# Build and run ts files
ts-node `file.ts`
ts-node src/index.ts
concurrently
- Concurrently helps running multiple scripts at the same time
"scripts": {
"start:build": "tsc -w",
"start:run": "nodemon build/index.js",
"start": "concurrently npm:start:*"
}
ts-node-dev
"scripts": {
"start": "ts-node-dev --respawn src/index.ts"
}