TypeScript, node.js development using Visual Studio 2012 express

How can I write, create and run a node.js application in Visual Studio? I install the TypeScript extension on VS and in node.js. package When I create a new project of type TypeScript, it can write a script only for browsers.

Update

I want autocomplete and error handling for node.js libraries

+8
visual-studio typescript tsc
source share
2 answers

You need to include a definition for node.js.

This file declares all operations for node.js so that you can get automatic completion and security type.

/// <reference path="./node.d.ts" /> var x = new SlowBuffer(5); 
+9
source share

You can just use VS as an editor, there is no need for solution files or anything else.

To create a node.js application, first install the typescript package:

 npm install -g typescript 

Then compile your file in javascript:

 tsc app.ts 

Run the application as a node process:

 node app.js 
+1
source share

All Articles