I want to use the latest version of Expess with node.js in TypeScript. Express.d.ts provided by microsoft in the samples seems to be built on versions prior to 3.0.x. In the previous version you could do
var app = express.createServer()
but after 3.0.x you should do:
var app = express();
Express.d.ts does not support this ... I found to hack this: I added the following line to Express.d.ts:
export function(): any;
In app.ts , when I want to create an application object, I do the following:
var app = <express.ExpressServer>express();
This seems to fix the problem, it compiles without errors, and also I get intellisense support. However, this is a hack ... First of all, why can't I write something like this?
export function(): ExpressServer;
Is this the recommended way to fix this problem?
source share