Backbencher.dev

Watch Mode in TypeScript

Last updated on 24 Jan, 2023

When working with a single TypeScript file, we repeatedly compile the file using tsc command. We can use watch mode to automatically compile the file on change.

Here is how you can use watch mode:

tsc app.ts --watch

You can also use shorter flag:

tsc app.ts -w

In watch mode, even if there is a TypeScript error, it is logged in the terminal. Correcting the error will again recompile the output JavaScript file.

--- ○ ---
Joby Joseph
Web Architect