Set Up Configuration Files For TypeScript Using Visual Studio Code

This is a fresh series of articles to learn TypeScript from scratch, using Visual Studio Code. Visual Studio Code is a new editor given by Microsoft. It’s a very rich tool in comparison to Sublime Text and others. This is my personal observation.

In the last article, you read about Getting Started With Typescript Using Visual Studio Code. Here, the continuation of the last article is that we are going to install the required configuration files like launch.json and tasks.json files.

Configuration settings for launch.json are given below in the screenshot. 

  1. {  
  2.     // Use IntelliSense to learn about possible Node.js debug attributes.  
  3.     // Hover to view descriptions of existing attributes.  
  4.     // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387  
  5.     "version""0.2.0",  
  6.     "configurations": [{  
  7.         "type""node",  
  8.         "request""launch",  
  9.         "name""Launch",  
  10.         "program""${workspaceRoot}\\myApp.ts",  
  11.         "cwd""${workspaceRoot}",  
  12.         "outFiles": ["${workspaceRoot}/js/**/*.js"],  
  13.         "sourceMaps"true  
  14.     }, {  
  15.         "type""node",  
  16.         "request""attach",  
  17.         "name""Attach",  
  18.         "port": 5858,  
  19.         "outFiles": ["ES5"],  
  20.         "sourceMaps"true  
  21.     }]  
  22. }  


Tasks.json file configuration is given below. 

  1. {  
  2.     // See https://go.microsoft.com/fwlink/?LinkId=733558  
  3.     // for the documentation about the tasks.json format  
  4.     "version""0.1.0",  
  5.     "command""tsc",  
  6.     "isShellCommand"true,  
  7.     "args": ["--target""ES5""--outdir""js""--sourceMap""--watch""myApp.ts"],  
  8.     "showOutput""always",  
  9.     "problemMatcher""$tsc",  
  10.     "echoCommand"true  
  11. }   

You can get IntelliSense on tasks.json variables, their values with hover and trigger smart completions with Ctrl+Space.

In the Command Palette (Ctrl+Shift+P), you can filter on 'task' and can see the various task related commands.


Select the Tasks

Configure Task Runner command and you will see a list of task runner templates. Select others to create a task, which runs an external command.

You should now see a tasks.json file in your Workspace .vscode folder with the content given below.


You can read more details from the given link.

Here is the glimpse of Visual Studio Code for debugging purposes and it looks  as shown below.


There is a lot to discuss in the upcoming articles.

  1. Code writing and IntelliSense
  2. Debugging process and configuration
  3. Class and constructor in TypeScript
  4. Any and Let Keyword usage
  5. Interface and DuckTyping
  6. Modules in Typescript and Exporting technique
  7. Setter and Getter Property in Typescript
  8. Tuples
  9. Enums, Watch and Call Stack for variables
  10. Will add more

I hope you have inferred the basics of TypeScript with Node and Visual Studio Code.

Up Next
    Ebook Download
    View all
    Test
    Read by 16 people
    Download Now!
    Learn
    View all