New Project
Tips for initializing a new project blank project
What you need to start a project from zero.
Start the node config file
package.jsonwithnpm --init.Install the Typescript as a dependency.
Create a config file for Typescript
tsconfig.json, withnpx tsc --init.
Transpile the Typescript code with
npx tsc.The transipled
.jswill be at theoutDirpath.
Then for last you just run the Javascript code.
Automating the transpilation and execution
At the package.json, you can create a new script:
tsc && node dist/main, wheredistis theoutDirspecified andmainis themain.jsor the starting execution script.
OR
You can install ts-node, which is a Typescript dependency for running Typescript directly.
npm install ts-node.Then just run
ts-node main.ts.
And if you install nodemon it will also recognize Typescript with ts-node, and keep running the Typescript application.
Last updated