Socket
Socket
Sign inDemoInstall

@types/express-serve-static-core

Package Overview
Dependencies
Maintainers
1
Versions
106
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/express-serve-static-core - npm Package Compare versions

Comparing version 4.17.17 to 4.17.18

170

express-serve-static-core/index.d.ts

@@ -21,12 +21,12 @@ // Type definitions for Express 4.17

// See for example method-override.d.ts (https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/method-override/index.d.ts)
interface Request { }
interface Response { }
interface Application { }
interface Request {}
interface Response {}
interface Application {}
}
}
import * as http from "http";
import { EventEmitter } from "events";
import { Options as RangeParserOptions, Result as RangeParserResult, Ranges as RangeParserRanges } from "range-parser";
import { ParsedQs } from "qs";
import * as http from 'http';
import { EventEmitter } from 'events';
import { Options as RangeParserOptions, Result as RangeParserResult, Ranges as RangeParserRanges } from 'range-parser';
import { ParsedQs } from 'qs';

@@ -41,32 +41,82 @@ export type Query = ParsedQs;

*/
(deferToNext: "router"): void;
(deferToNext: 'router'): void;
}
export interface Dictionary<T> { [key: string]: T; }
export interface Dictionary<T> {
[key: string]: T;
}
export interface ParamsDictionary { [key: string]: string; }
export interface ParamsDictionary {
[key: string]: string;
}
export type ParamsArray = string[];
export type Params = ParamsDictionary | ParamsArray;
export interface RequestHandler<P = ParamsDictionary, ResBody = any, ReqBody = any, ReqQuery = ParsedQs> {
export interface RequestHandler<
P = ParamsDictionary,
ResBody = any,
ReqBody = any,
ReqQuery = ParsedQs,
Locals extends Record<string, any> = Record<string, 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, ResBody, ReqBody, ReqQuery>, res: Response<ResBody>, next: NextFunction): void;
(
req: Request<P, ResBody, ReqBody, ReqQuery, Locals>,
res: Response<ResBody, Locals>,
next: NextFunction,
): void;
}
export type ErrorRequestHandler<P = ParamsDictionary, ResBody = any, ReqBody = any, ReqQuery = ParsedQs> =
(err: any, req: Request<P, ResBody, ReqBody, ReqQuery>, res: Response<ResBody>, next: NextFunction) => void;
export type ErrorRequestHandler<
P = ParamsDictionary,
ResBody = any,
ReqBody = any,
ReqQuery = ParsedQs,
Locals extends Record<string, any> = Record<string, any>
> = (
err: any,
req: Request<P, ResBody, ReqBody, ReqQuery, Locals>,
res: Response<ResBody, Locals>,
next: NextFunction,
) => void;
export type PathParams = string | RegExp | Array<string | RegExp>;
export type RequestHandlerParams<P = ParamsDictionary, ResBody = any, ReqBody = any, ReqQuery = ParsedQs>
= RequestHandler<P, ResBody, ReqBody, ReqQuery>
| ErrorRequestHandler<P, ResBody, ReqBody, ReqQuery>
| Array<RequestHandler<P>
| ErrorRequestHandler<P>>;
export type RequestHandlerParams<
P = ParamsDictionary,
ResBody = any,
ReqBody = any,
ReqQuery = ParsedQs,
Locals extends Record<string, any> = Record<string, any>
> =
| RequestHandler<P, ResBody, ReqBody, ReqQuery, Locals>
| ErrorRequestHandler<P, ResBody, ReqBody, ReqQuery, Locals>
| Array<RequestHandler<P> | ErrorRequestHandler<P>>;
export interface IRouterMatcher<T, Method extends 'all' | 'get' | 'post' | 'put' | 'delete' | 'patch' | 'options' | 'head' = any> {
// tslint:disable-next-line no-unnecessary-generics (This generic is meant to be passed explicitly.)
<P = ParamsDictionary, ResBody = any, ReqBody = any, ReqQuery = ParsedQs>(path: PathParams, ...handlers: Array<RequestHandler<P, ResBody, ReqBody, ReqQuery>>): T;
// tslint:disable-next-line no-unnecessary-generics (This generic is meant to be passed explicitly.)
<P = ParamsDictionary, ResBody = any, ReqBody = any, ReqQuery = ParsedQs>(path: PathParams, ...handlers: Array<RequestHandlerParams<P, ResBody, ReqBody, ReqQuery>>): T;
export interface IRouterMatcher<
T,
Method extends 'all' | 'get' | 'post' | 'put' | 'delete' | 'patch' | 'options' | 'head' = any
> {
<
P = ParamsDictionary,
ResBody = any,
ReqBody = any,
ReqQuery = ParsedQs,
Locals extends Record<string, any> = Record<string, any>
>(
path: PathParams,
// tslint:disable-next-line no-unnecessary-generics (This generic is meant to be passed explicitly.)
...handlers: Array<RequestHandler<P, ResBody, ReqBody, ReqQuery, Locals>>
): T;
<
P = ParamsDictionary,
ResBody = any,
ReqBody = any,
ReqQuery = ParsedQs,
Locals extends Record<string, any> = Record<string, any>
>(
path: PathParams,
// tslint:disable-next-line no-unnecessary-generics (This generic is meant to be passed explicitly.)
...handlers: Array<RequestHandlerParams<P, ResBody, ReqBody, ReqQuery, Locals>>
): T;
(path: PathParams, subApplication: Application): T;

@@ -78,6 +128,22 @@ }

(...handlers: RequestHandlerParams[]): T;
// tslint:disable-next-line no-unnecessary-generics (This generic is meant to be passed explicitly.)
<P = ParamsDictionary, ResBody = any, ReqBody = any, ReqQuery = ParsedQs>(...handlers: Array<RequestHandler<P, ResBody, ReqBody, ReqQuery>>): T;
// tslint:disable-next-line no-unnecessary-generics (This generic is meant to be passed explicitly.)
<P = ParamsDictionary, ResBody = any, ReqBody = any, ReqQuery = ParsedQs>(...handlers: Array<RequestHandlerParams<P, ResBody, ReqBody, ReqQuery>>): T;
<
P = ParamsDictionary,
ResBody = any,
ReqBody = any,
ReqQuery = ParsedQs,
Locals extends Record<string, any> = Record<string, any>
>(
// tslint:disable-next-line no-unnecessary-generics (This generic is meant to be passed explicitly.)
...handlers: Array<RequestHandler<P, ResBody, ReqBody, ReqQuery, Locals>>
): T;
<
P = ParamsDictionary,
ResBody = any,
ReqBody = any,
ReqQuery = ParsedQs,
Locals extends Record<string, any> = Record<string, any>
>(
// tslint:disable-next-line no-unnecessary-generics (This generic is meant to be passed explicitly.)
...handlers: Array<RequestHandlerParams<P, ResBody, ReqBody, ReqQuery, Locals>>
): T;
}

@@ -142,3 +208,3 @@

move: IRouterMatcher<this>;
"m-search": IRouterMatcher<this>;
'm-search': IRouterMatcher<this>;
notify: IRouterMatcher<this>;

@@ -183,3 +249,3 @@ propfind: IRouterMatcher<this>;

move: IRouterHandler<this>;
"m-search": IRouterHandler<this>;
'm-search': IRouterHandler<this>;
notify: IRouterHandler<this>;

@@ -195,3 +261,3 @@ purge: IRouterHandler<this>;

export interface Router extends IRouter { }
export interface Router extends IRouter {}

@@ -210,5 +276,8 @@ export interface CookieOptions {

export interface ByteRange { start: number; end: number; }
export interface ByteRange {
start: number;
end: number;
}
export interface RequestRanges extends RangeParserRanges { }
export interface RequestRanges extends RangeParserRanges {}

@@ -230,3 +299,10 @@ export type Errback = (err: Error) => void;

*/
export interface Request<P = ParamsDictionary, ResBody = any, ReqBody = any, ReqQuery = ParsedQs> extends http.IncomingMessage, Express.Request {
export interface Request<
P = ParamsDictionary,
ResBody = any,
ReqBody = any,
ReqQuery = ParsedQs,
Locals extends Record<string, any> = Record<string, any>
> extends http.IncomingMessage,
Express.Request {
/**

@@ -251,6 +327,6 @@ * Return request header.

*/
get(name: "set-cookie"): string[] | undefined;
get(name: 'set-cookie'): string[] | undefined;
get(name: string): string | undefined;
header(name: "set-cookie"): string[] | undefined;
header(name: 'set-cookie'): string[] | undefined;
header(name: string): string | undefined;

@@ -504,3 +580,3 @@

*/
res?: Response<ResBody>;
res?: Response<ResBody, Locals>;
next?: NextFunction;

@@ -518,3 +594,8 @@ }

export interface Response<ResBody = any, StatusCode extends number = number> extends http.ServerResponse, Express.Response {
export interface Response<
ResBody = any,
Locals extends Record<string, any> = Record<string, any>,
StatusCode extends number = number
> extends http.ServerResponse,
Express.Response {
/**

@@ -859,3 +940,3 @@ * Set status `code`.

locals: Record<string, any>;
locals: Locals;

@@ -893,7 +974,9 @@ charset: string;

export interface Handler extends RequestHandler { }
export interface Handler extends RequestHandler {}
export type RequestParamHandler = (req: Request, res: Response, next: NextFunction, value: any, name: string) => any;
export type ApplicationRequestHandler<T> = IRouterHandler<T> & IRouterMatcher<T> & ((...handlers: RequestHandlerParams[]) => T);
export type ApplicationRequestHandler<T> = IRouterHandler<T> &
IRouterMatcher<T> &
((...handlers: RequestHandlerParams[]) => T);

@@ -949,3 +1032,6 @@ export interface Application extends EventEmitter, IRouter, Express.Application {

*/
engine(ext: string, fn: (path: string, options: object, callback: (e: any, rendered?: string) => void) => void): this;
engine(
ext: string,
fn: (path: string, options: object, callback: (e: any, rendered?: string) => void) => void,
): this;

@@ -952,0 +1038,0 @@ /**

{
"name": "@types/express-serve-static-core",
"version": "4.17.17",
"version": "4.17.18",
"description": "TypeScript definitions for Express",

@@ -61,4 +61,4 @@ "license": "MIT",

},
"typesPublisherContentHash": "6a2ede4cf42aedc8c6cd545ef9b4687b688370023e3a3e34aae2169ab97b5b01",
"typesPublisherContentHash": "60873d177898f88d23027366f6d52aec9d27759ca997fea4f7c6b9729356fc20",
"typeScriptVersion": "3.3"
}

@@ -11,3 +11,3 @@ # Installation

### Additional Details
* Last updated: Tue, 15 Dec 2020 17:30:38 GMT
* Last updated: Mon, 11 Jan 2021 22:13:26 GMT
* Dependencies: [@types/range-parser](https://npmjs.com/package/@types/range-parser), [@types/qs](https://npmjs.com/package/@types/qs), [@types/node](https://npmjs.com/package/@types/node)

@@ -14,0 +14,0 @@ * Global values: none

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc