Arvind Singh Arvind Singh - 1 year ago 274
Node.js Question

Visual studio 2015 - node.js, express 4 using typescript project does not compile

There does not exist a project template that uses Typescript with Express4, there does however exist typescript template using express3. Is it that TS is incompatible with Express4.

I tried by creating regular TS with Express3 template, uninstalled Express3 npm package and added Express4 package. It did not compile.
I also added TDS as explained in and it gave more errors like cannot find property express.favicon().

Answer Source

Simply create "Basic Node.js Express 4 Application" JavaScipt type application and after remove app.js and add app.ts. After it restart VS and now you should see TS as project icon.

Also run this in package manager console

npm install tsd -g
tsd install express --save

and add this line in the top of app.ts

/// <reference path="path to your tsd.d.ts" />

usually tsd.d.ts will be placed in the root of your solution folder in typings folder

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download