Suppose I want to use something like express. So I add
/// <reference path=".../express.d.ts" />
import express = require("express");
and can then use types like ExpressServerRequest.
So far so good. But now I want to use, for example, the connect-flash javascript module. This adds an additional flash function to ExpressServerRequest. I'm struggling to see how to define connect-flash.d.ts so that req.flash() is defined on instances of ExpressServerRequest if I've imported the connect-flash module, and not defined otherwise. Can this behaviour be captued in TypeScript?