Quantcast
Viewing all articles
Browse latest Browse all 10804

Using TypeScript in Visual Studio Code

With the recent announcement of Visual Studio Code, there have been a lot of questions about how to get started writing TypeScript.  In this quickstart, we’ll create a simple TypeScript project.  Out of the box, Visual Studio Code supports TypeScript 1.5 beta and using either the node or Visual Studio command-line compilers.

Let’s start by making a new empty folder, MyProject, and opening it in Visual Studio Code. In Window, click “Open Folder”; on OS X, click “Open” and select a folder:


Image may be NSFW.
Clik here to view.
openfolder.png

Create a new file by clicking “New FIle” in the MyProject row of the Explore Sidebar:

Image may be NSFW.
Clik here to view.
newfile.png

Enter “tsconfig.json” as the filename

Type { } in the file and hit Ctrl-Space between the braces to trigger completion:

Image may be NSFW.
Clik here to view.
tsconfigautocomplete.png

We can configure the project for ES5, AMD modules, and source maps:

Image may be NSFW.
Clik here to view.
tsconfigcomplete.png

Using “New File” again, add a TypeScript file and try writing some code in it:

Image may be NSFW.
Clik here to view.
withletfile.png

Before anything else, let’s try compiling with the Ctrl-Shift-B shortcut key. A message appears telling us that we don’t have a task runner enabled for this project yet. Click “Configure Task Runner” to set up a config file:

Image may be NSFW.
Clik here to view.
notaskrunner2.png

Remove “HelloWorld.ts” from the “args” array, and add a property called “isShellCommand” with the value ‘true’ in the config file:

Image may be NSFW.
Clik here to view.
tasksjsonconfig.png

While your application is building, you’ll notice an indicator at the bottom left of the screen

Image may be NSFW.
Clik here to view.
buildinprogress.png

The icons show source control status, build indicator (spinning), number of errors, and number of warnings.  You can click on the source control, error, and warning indicators for more information.

In the lower right corner, you’ll see the rest of the status bar, showing the cursor position, line endings, language, and smiley. Click the smiley to send us feedback!

Image may be NSFW.
Clik here to view.

Visual Studio Code is still a preview release.  If you notice issues or have ideas for feature requests, be sure to use the smiley to let us know.  We look forward to hearing from you.
Image may be NSFW.
Clik here to view.

Viewing all articles
Browse latest Browse all 10804

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>