Fixed deprecated express 3.x functions

- Fixed deprecated express 3.x functions as reporte in issue https://github.com/DefinitelyTyped/DefinitelyTyped/issues/7507
- Also updated use() fonction when having only one handler parameter
This commit is contained in:
brierel
2016-01-12 11:39:29 +01:00
parent faa49cc680
commit 941b8aabd2

53
express/express.d.ts vendored
View File

@@ -103,9 +103,9 @@ declare module "express" {
route(path: string): IRoute;
use(...handler: RequestHandler[]): T;
use(handler: ErrorRequestHandler): T;
use(handler: ErrorRequestHandler|RequestHandler): T;
use(path: string, ...handler: RequestHandler[]): T;
use(path: string, handler: ErrorRequestHandler): T;
use(path: string, handler: ErrorRequestHandler|RequestHandler): T;
use(path: string[], ...handler: RequestHandler[]): T;
use(path: string[], handler: ErrorRequestHandler): T;
use(path: RegExp, ...handler: RequestHandler[]): T;
@@ -200,20 +200,35 @@ declare module "express" {
accepts(type: string[]): string;
/**
* Check if the given `charset` is acceptable,
* otherwise you should respond with 406 "Not Acceptable".
* Returns the first accepted charset of the specified character sets,
* based on the requests Accept-Charset HTTP header field.
* If none of the specified charsets is accepted, returns false.
*
* For more information, or if you have issues or concerns, see accepts.
* @param charset
*/
acceptsCharset(charset: string): boolean;
acceptsCharsets(charset?: string|string[]): string[];
/**
* Check if the given `lang` is acceptable,
* otherwise you should respond with 406 "Not Acceptable".
* Returns the first accepted encoding of the specified encodings,
* based on the requests Accept-Encoding HTTP header field.
* If none of the specified encodings is accepted, returns false.
*
* For more information, or if you have issues or concerns, see accepts.
* @param encoding
*/
acceptsEncodings(encoding?: string|string[]): string[];
/**
* Returns the first accepted language of the specified languages,
* based on the requests Accept-Language HTTP header field.
* If none of the specified languages is accepted, returns false.
*
* For more information, or if you have issues or concerns, see accepts.
*
* @param lang
*/
acceptsLanguage(lang: string): boolean;
acceptsLanguages(lang?: string|string[]): string[];
/**
* Parse Range header field,
@@ -240,28 +255,6 @@ declare module "express" {
*/
accepted: MediaType[];
/**
* Return an array of Accepted languages
* ordered from highest quality to lowest.
*
* Examples:
*
* Accept-Language: en;q=.5, en-us
* ['en-us', 'en']
*/
acceptedLanguages: any[];
/**
* Return an array of Accepted charsets
* ordered from highest quality to lowest.
*
* Examples:
*
* Accept-Charset: iso-8859-5;q=.2, unicode-1-1;q=0.8
* ['unicode-1-1', 'iso-8859-5']
*/
acceptedCharsets: any[];
/**
* Return the value of param `name` when present or `defaultValue`.
*