Preparing for this chapter
To prepare for this chapter, create a folder named primer
in a convenient location. Navigate to the primer
folder and run the command shown in Listing 3.1.
npm init --yes
Run the command shown in Listing 3.2 in the primer
folder to install the development packages that are used in this chapter.
npm install nodemon@2.0.20
npm install tsc-watch@6.0.4
npm install typescript@5.2.2
npm install @tsconfig/node20@20.1.4
npm install @types/node@20.6.1
The nodemon
package will be used at the start of the chapter to monitor and execute JavaScript files. The tsc-watch
package does the same thing for TypeScript files, and the typescript
package contains the TypeScript compiler. The @tsconfig/node20
package contains configuration settings for the TypeScript compiler for use in Node.js projects.
Replace the scripts
section in the package.json
file as shown in Listing 3.3, which will...