- The top-level modules Express and NodeJs are now 'pure' ie
non-instantiated, due to removal of all vars, functions, and classes
- Where the above change breaks existing typings which access types via
external module references, a shim has been added to make this continue
working unchanged
- A single namespace _ExternalShim_ is added but this can be reused
across all typings that need shimming
- 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
Everything (in both node and express) now follows the pattern:
```
declare module "external-name" {
import _ = InternalName.InnerName;
export = _;
}
declare module InternalName {
export var InnerName: InnerName;
export interface InnerName {
// functions and vars in here
}
export module InnerName {
// Must be non-instantiated - so only interfaces and modules in here
}
}
```
All node modules and classes can be referenced by type name. External
module support remains unchanged, but now static type information is
available for all node modules and types without needing to go through
the external module definitions.
Similar for express.
TypeScript 0.9.5 beta does not allow generic type references without the type argument. This code will still compile for 0.9.1 users. Flight and Ember have further compile problems in 0.9.5 that I don't feel qualified to address as I'm not versed in those libraries.
app.listen is fixed so that it can be called with a port, hostname, and
optional callback without a backlog parameter.
app.listen is fixed so callback parameter is always optional.
CSRF protection middleware definition is fixed so options parameter is
optional.
req.csrfToken method is added since the CSRF protection middleware has
been updated.
- Move Express-prefixed interface names into internal module as
unprefixed names
- The importing code will use express.Response instead of
ExpressServerResponse
- Internal definitions can just use Response instead of
ExpressServerResponse
- Response should extend http.Response to be able to type check .end
for example
This enables each definition to have a readme if necessary.
Also a .json metadata file to help with package managers.
And last, to have different versions of the definitions.