Arvind Singh
Arvind Singh

Reputation: 792

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 https://code.visualstudio.com/Docs/runtimes/nodejs and it gave more errors like cannot find property express.favicon().

Upvotes: 0

Views: 1406

Answers (1)

Georgi Gevorgyan
Georgi Gevorgyan

Reputation: 400

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

Upvotes: 0

Related Questions