Fixed assert, added comments, rechecked all

- Added comments explaining the rationale/method of exposing into both
'type' and 'member' declaration spaces (see TLR 2.3) with example
- Made the pattern consistent in both definition files
- Fixed "assert" by adding 'export function Assert...'
- Triple-checked with DT tests and additional tests
This commit is contained in:
Troy Gerwien
2014-03-30 21:56:50 +08:00
parent 6f472b8f09
commit c2b67de6aa
2 changed files with 71 additions and 31 deletions
+14 -1
View File
@@ -17,7 +17,19 @@ declare module "express" {
export = _;
}
declare module Express {
export function Static(): Static.Express;
// NB: All typings in Express.Static are exposed in dual declaration spaces
// (i.e. as 'types' and as 'members' - see TypeScript Language Spec section 2.3)
// so that type information is available in both of the following scenarios:
//
// // Normal import:
// import express = require('express');
// var app = express();
// app.use(express.urlencoded());
//
// // Typed variable:
// var express: Express.Static = someExpr() // a wrapped, mocked or otherwise obtained ref
// var app = express();
// app.use(express.urlencoded());
export interface Static {
(): Static.Express;
Route: new (method: string, path: string, callbacks: Function[], options: any) => Static.Route;
@@ -55,6 +67,7 @@ declare module Express {
urlencoded(): any;
multipart(): any;
}
export function Static(): Static.Express;
export module Static {
interface IRoute {