Watch mode removes the need to restart a compiler or test runner after each edit. The TypeScript compiler monitors the project and recompiles when files change; Jest reruns unit tests when tests or application code change. section 5.5.2 section 6.4.3
Listing 5.12 Starting the compiler in watch mode
tsc --watch
Run `tsc --watch` from the project folder to compile once and keep watching. Saving a change triggers another compilation; the compiler reports errors or confirms that it found none. section 5.5.2
Compilation and execution are separate. `tsc --watch` does not run the generated JavaScript: run it separately with Node.js, or use `tsc-watch --onsuccess "node dist/index.js"` to execute it after successful compilation. A package.json `start` script can hold that command so `npm start` starts the workflow. Avoid launching Node.js merely because an output file changed: generated files are not necessarily written at the same time. section 5.5.2 section 7.1
Listing 6.17 Starting the unit test framework in watch mode
npx jest --watchAll
Run `npx jest --watchAll` in a second prompt to keep unit-test results visible alongside compiler output. Jest reports failures and reruns tests after changes; its watch controls can narrow runs to failed tests or tests related to changed files. section 6.4.3
If compiler watch mode stops with `Check failed: U_SUCCESS(status)`, updating Node.js may resolve the problem. The watch process is a development convenience, not a replacement for checking whether compilation succeeded or whether tests passed. section 5.5.2 section 6.4.3
