Some of my other articles about Visual Studio Code :
- Using TypeScript with Visual Studio Code on OSX
- Setting up Github with Visual Studio Code on OSX
- Automatically Compile Your TypeScript Files with Visual Studio Code on OSX
I’ve been using Visual Studio Code since it was released at Build 2015. As I’ve been using this powerful editor, I’ve come across a couple of ways to make it even better and I thought I’d share it with the community. In this post, we are going to make our .ts (TypeScript) files auto-compile instead of performing the Build command every time we make changes to our .ts files.
Before we get started, simply followt his post and make sure TypeScript is installed and working.
A Little Help from TSC
Navigate to your Visual Studio Code Folder and open a terminal window here and enter the following command:
tsc *.ts --watch
This is going to monitor the folder for any changes in our TypeScript files and compile them behind the scenes. Here is what the output looks like once you start it:
message TS6042: Compilation complete. Watching for file changes. message TS6032: File change detected. Starting incremental compilation... message TS6042: Compilation complete. Watching for file changes.
Switch Back to Visual Studio Code
Note: Since this is a Node app, Control-C will kill the process in the terminal window if you want to stop tsc from watching for file changes.
Like this Post?
Thanks for reading and if you like this post, then share it with one of the buttons below. Also, feel free to leave a comment below.