@types/express-serve-static-core
Advanced tools
Comparing version 4.16.11 to 4.17.0
@@ -1,2 +0,2 @@ | ||
// Type definitions for Express 4.16 | ||
// Type definitions for Express 4.17 | ||
// Project: http://expressjs.com | ||
@@ -9,2 +9,3 @@ // Definitions by: Boris Yankov <https://github.com/borisyankov> | ||
// aereal <https://github.com/aereal> | ||
// Jose Luis Leon <https://github.com/JoseLion> | ||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped | ||
@@ -41,18 +42,22 @@ // TypeScript Version: 2.3 | ||
export interface RequestHandler<P extends Params = ParamsDictionary> { | ||
export interface RequestHandler<P extends Params = ParamsDictionary, ResBody = any, ReqBody = any> { | ||
// tslint:disable-next-line callable-types (This is extended from and can't extend from a type alias in ts<2.2 | ||
(req: Request<P>, res: Response, next: NextFunction): any; | ||
(req: Request<P, ResBody, ReqBody>, res: Response<ResBody>, next: NextFunction): any; | ||
} | ||
export type ErrorRequestHandler<P extends Params = ParamsDictionary> = (err: any, req: Request<P>, res: Response, next: NextFunction) => any; | ||
export type ErrorRequestHandler<P extends Params = ParamsDictionary, ResBody = any, ReqBody = any> = (err: any, req: Request<P, ResBody, ReqBody>, res: Response<ResBody>, next: NextFunction) => any; | ||
export type PathParams = string | RegExp | Array<string | RegExp>; | ||
export type RequestHandlerParams<P extends Params = ParamsDictionary> = RequestHandler<P> | ErrorRequestHandler<P> | Array<RequestHandler<P> | ErrorRequestHandler<P>>; | ||
export type RequestHandlerParams<P extends Params = ParamsDictionary, ResBody = any, ReqBody = any> | ||
= RequestHandler<P, ResBody, ReqBody> | ||
| ErrorRequestHandler<P, ResBody, ReqBody> | ||
| Array<RequestHandler<P> | ||
| ErrorRequestHandler<P>>; | ||
export interface IRouterMatcher<T> { | ||
// tslint:disable-next-line no-unnecessary-generics (This generic is meant to be passed explicitly.) | ||
<P extends Params = ParamsDictionary>(path: PathParams, ...handlers: Array<RequestHandler<P>>): T; | ||
<P extends Params = ParamsDictionary, ResBody = any, ReqBody = any>(path: PathParams, ...handlers: Array<RequestHandler<P, ResBody, ReqBody>>): T; | ||
// tslint:disable-next-line no-unnecessary-generics (This generic is meant to be passed explicitly.) | ||
<P extends Params = ParamsDictionary>(path: PathParams, ...handlers: Array<RequestHandlerParams<P>>): T; | ||
<P extends Params = ParamsDictionary, ResBody = any, ReqBody = any>(path: PathParams, ...handlers: Array<RequestHandlerParams<P, ResBody, ReqBody>>): T; | ||
(path: PathParams, subApplication: Application): T; | ||
@@ -207,3 +212,3 @@ } | ||
*/ | ||
export interface Request<P extends Params = ParamsDictionary> extends http.IncomingMessage, Express.Request { | ||
export interface Request<P extends Params = ParamsDictionary, ResBody = any, ReqBody = any> extends http.IncomingMessage, Express.Request { | ||
/** | ||
@@ -453,3 +458,3 @@ * Return request header. | ||
//body: { username: string; password: string; remember: boolean; title: string; }; | ||
body: any; | ||
body: ReqBody; | ||
@@ -481,3 +486,3 @@ //cookies: { string; remember: boolean; }; | ||
*/ | ||
res?: Response; | ||
res?: Response<ResBody>; | ||
next?: NextFunction; | ||
@@ -493,5 +498,5 @@ } | ||
export type Send<T = Response> = (body?: any) => T; | ||
export type Send<ResBody = any, T = Response<ResBody>> = (body?: ResBody) => T; | ||
export interface Response extends http.ServerResponse, Express.Response { | ||
export interface Response<ResBody = any> extends http.ServerResponse, Express.Response { | ||
/** | ||
@@ -537,3 +542,3 @@ * Set status `code`. | ||
*/ | ||
send: Send<this>; | ||
send: Send<ResBody, this>; | ||
@@ -550,3 +555,3 @@ /** | ||
*/ | ||
json: Send<this>; | ||
json: Send<ResBody, this>; | ||
@@ -563,3 +568,3 @@ /** | ||
*/ | ||
jsonp: Send<this>; | ||
jsonp: Send<ResBody, this>; | ||
@@ -566,0 +571,0 @@ /** |
{ | ||
"name": "@types/express-serve-static-core", | ||
"version": "4.16.11", | ||
"version": "4.17.0", | ||
"description": "TypeScript definitions for Express", | ||
@@ -36,6 +36,11 @@ "license": "MIT", | ||
"githubUsername": "aereal" | ||
}, | ||
{ | ||
"name": "Jose Luis Leon", | ||
"url": "https://github.com/JoseLion", | ||
"githubUsername": "JoseLion" | ||
} | ||
], | ||
"main": "", | ||
"types": "index", | ||
"types": "index.d.ts", | ||
"repository": { | ||
@@ -51,4 +56,4 @@ "type": "git", | ||
}, | ||
"typesPublisherContentHash": "cf0a8fdb1c3e5d905989b7e04f3ef58a3de201f6fb30d4ec59f919a4177a6ca2", | ||
"typeScriptVersion": "2.3" | ||
"typesPublisherContentHash": "0f26c7a2c15b8dfa4210c3a5f55de334441a85ec7bf9736a5b0a4a204ac39048", | ||
"typeScriptVersion": "2.8" | ||
} |
@@ -8,10 +8,10 @@ # Installation | ||
# Details | ||
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/express-serve-static-core | ||
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/express-serve-static-core. | ||
Additional Details | ||
* Last updated: Fri, 01 Nov 2019 17:24:49 GMT | ||
* Dependencies: @types/range-parser, @types/node | ||
### Additional Details | ||
* Last updated: Fri, 15 Nov 2019 21:45:40 GMT | ||
* Dependencies: [@types/range-parser](https://npmjs.com/package/@types/range-parser), [@types/node](https://npmjs.com/package/@types/node) | ||
* Global values: none | ||
# Credits | ||
These definitions were written by Boris Yankov <https://github.com/borisyankov>, Michał Lytek <https://github.com/19majkel94>, Kacper Polak <https://github.com/kacepe>, Satana Charuwichitratana <https://github.com/micksatana>, Sami Jaber <https://github.com/samijaber>, and aereal <https://github.com/aereal>. | ||
These definitions were written by Boris Yankov (https://github.com/borisyankov), Michał Lytek (https://github.com/19majkel94), Kacper Polak (https://github.com/kacepe), Satana Charuwichitratana (https://github.com/micksatana), Sami Jaber (https://github.com/samijaber), aereal (https://github.com/aereal), and Jose Luis Leon (https://github.com/JoseLion). |
38904
960