@types/express-serve-static-core
Advanced tools
Comparing version 4.17.36 to 4.17.37
@@ -15,3 +15,3 @@ // Type definitions for Express 4.17 | ||
import { SendOptions } from 'send'; | ||
import { SendOptions } from "send"; | ||
@@ -29,6 +29,6 @@ declare global { | ||
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 { EventEmitter } from "events"; | ||
import * as http from "http"; | ||
import { ParsedQs } from "qs"; | ||
import { Options as RangeParserOptions, Ranges as RangeParserRanges, Result as RangeParserResult } from "range-parser"; | ||
@@ -45,3 +45,3 @@ export {}; | ||
*/ | ||
(deferToNext: 'router'): void; | ||
(deferToNext: "router"): void; | ||
/** | ||
@@ -51,3 +51,3 @@ * "Break-out" of a route by calling {next('route')}; | ||
*/ | ||
(deferToNext: 'route'): void; | ||
(deferToNext: "route"): void; | ||
} | ||
@@ -72,3 +72,3 @@ | ||
ReqQuery = ParsedQs, | ||
LocalsObj extends Record<string, any> = Record<string, any> | ||
LocalsObj extends Record<string, any> = Record<string, any>, | ||
> { | ||
@@ -88,3 +88,3 @@ // tslint:disable-next-line callable-types (This is extended from and can't extend from a type alias in ts<2.2) | ||
ReqQuery = ParsedQs, | ||
LocalsObj extends Record<string, any> = Record<string, any> | ||
LocalsObj extends Record<string, any> = Record<string, any>, | ||
> = ( | ||
@@ -104,3 +104,3 @@ err: any, | ||
ReqQuery = ParsedQs, | ||
LocalsObj extends Record<string, any> = Record<string, any> | ||
LocalsObj extends Record<string, any> = Record<string, any>, | ||
> = | ||
@@ -118,21 +118,16 @@ | RequestHandler<P, ResBody, ReqBody, ReqQuery, LocalsObj> | ||
// prettier-ignore | ||
export type RouteParameters<Route extends string> = string extends Route | ||
? ParamsDictionary | ||
: Route extends `${string}(${string}` | ||
? ParamsDictionary //TODO: handling for regex parameters | ||
: Route extends `${string}:${infer Rest}` | ||
? ( | ||
GetRouteParameter<Rest> extends never | ||
? ParamsDictionary | ||
: GetRouteParameter<Rest> extends `${infer ParamName}?` | ||
? { [P in ParamName]?: string } | ||
export type RouteParameters<Route extends string> = string extends Route ? ParamsDictionary | ||
: Route extends `${string}(${string}` ? ParamsDictionary // TODO: handling for regex parameters | ||
: Route extends `${string}:${infer Rest}` ? | ||
& ( | ||
GetRouteParameter<Rest> extends never ? ParamsDictionary | ||
: GetRouteParameter<Rest> extends `${infer ParamName}?` ? { [P in ParamName]?: string } | ||
: { [P in GetRouteParameter<Rest>]: string } | ||
) & | ||
(Rest extends `${GetRouteParameter<Rest>}${infer Next}` | ||
? RouteParameters<Next> : unknown) | ||
: {}; | ||
) | ||
& (Rest extends `${GetRouteParameter<Rest>}${infer Next}` ? RouteParameters<Next> : unknown) | ||
: {}; | ||
export interface IRouterMatcher< | ||
T, | ||
Method extends 'all' | 'get' | 'post' | 'put' | 'delete' | 'patch' | 'options' | 'head' = any | ||
Method extends "all" | "get" | "post" | "put" | "delete" | "patch" | "options" | "head" = any, | ||
> { | ||
@@ -145,3 +140,3 @@ < | ||
ReqQuery = ParsedQs, | ||
LocalsObj extends Record<string, any> = Record<string, any> | ||
LocalsObj extends Record<string, any> = Record<string, any>, | ||
>( | ||
@@ -161,3 +156,3 @@ // (it's used as the default type parameter for P) | ||
ReqQuery = ParsedQs, | ||
LocalsObj extends Record<string, any> = Record<string, any> | ||
LocalsObj extends Record<string, any> = Record<string, any>, | ||
>( | ||
@@ -176,3 +171,3 @@ // (it's used as the default type parameter for P) | ||
ReqQuery = ParsedQs, | ||
LocalsObj extends Record<string, any> = Record<string, any> | ||
LocalsObj extends Record<string, any> = Record<string, any>, | ||
>( | ||
@@ -189,3 +184,3 @@ path: PathParams, | ||
ReqQuery = ParsedQs, | ||
LocalsObj extends Record<string, any> = Record<string, any> | ||
LocalsObj extends Record<string, any> = Record<string, any>, | ||
>( | ||
@@ -208,6 +203,6 @@ path: PathParams, | ||
ReqQuery = ParsedQs, | ||
LocalsObj extends Record<string, any> = Record<string, any> | ||
>( | ||
LocalsObj extends Record<string, any> = Record<string, any>, | ||
>( | ||
// (This generic is meant to be passed explicitly.) | ||
// eslint-disable-next-line @definitelytyped/no-unnecessary-generics | ||
// eslint-disable-next-line @definitelytyped/no-unnecessary-generics | ||
...handlers: Array<RequestHandler<P, ResBody, ReqBody, ReqQuery, LocalsObj>> | ||
@@ -220,6 +215,6 @@ ): T; | ||
ReqQuery = ParsedQs, | ||
LocalsObj extends Record<string, any> = Record<string, any> | ||
>( | ||
LocalsObj extends Record<string, any> = Record<string, any>, | ||
>( | ||
// (This generic is meant to be passed explicitly.) | ||
// eslint-disable-next-line @definitelytyped/no-unnecessary-generics | ||
// eslint-disable-next-line @definitelytyped/no-unnecessary-generics | ||
...handlers: Array<RequestHandlerParams<P, ResBody, ReqBody, ReqQuery, LocalsObj>> | ||
@@ -232,3 +227,3 @@ ): T; | ||
ReqQuery = ParsedQs, | ||
LocalsObj extends Record<string, any> = Record<string, any> | ||
LocalsObj extends Record<string, any> = Record<string, any>, | ||
>( | ||
@@ -244,3 +239,3 @@ // (This generic is meant to be passed explicitly.) | ||
ReqQuery = ParsedQs, | ||
LocalsObj extends Record<string, any> = Record<string, any> | ||
LocalsObj extends Record<string, any> = Record<string, any>, | ||
>( | ||
@@ -293,10 +288,10 @@ // (This generic is meant to be passed explicitly.) | ||
*/ | ||
all: IRouterMatcher<this, 'all'>; | ||
get: IRouterMatcher<this, 'get'>; | ||
post: IRouterMatcher<this, 'post'>; | ||
put: IRouterMatcher<this, 'put'>; | ||
delete: IRouterMatcher<this, 'delete'>; | ||
patch: IRouterMatcher<this, 'patch'>; | ||
options: IRouterMatcher<this, 'options'>; | ||
head: IRouterMatcher<this, 'head'>; | ||
all: IRouterMatcher<this, "all">; | ||
get: IRouterMatcher<this, "get">; | ||
post: IRouterMatcher<this, "post">; | ||
put: IRouterMatcher<this, "put">; | ||
delete: IRouterMatcher<this, "delete">; | ||
patch: IRouterMatcher<this, "patch">; | ||
options: IRouterMatcher<this, "options">; | ||
head: IRouterMatcher<this, "head">; | ||
@@ -311,3 +306,3 @@ checkout: IRouterMatcher<this>; | ||
move: IRouterMatcher<this>; | ||
'm-search': IRouterMatcher<this>; | ||
"m-search": IRouterMatcher<this>; | ||
notify: IRouterMatcher<this>; | ||
@@ -355,3 +350,3 @@ propfind: IRouterMatcher<this>; | ||
move: IRouterHandler<this, Route>; | ||
'm-search': IRouterHandler<this, Route>; | ||
"m-search": IRouterHandler<this, Route>; | ||
notify: IRouterHandler<this, Route>; | ||
@@ -378,3 +373,3 @@ purge: IRouterHandler<this, Route>; | ||
encode?: ((val: string) => string) | undefined; | ||
sameSite?: boolean | 'lax' | 'strict' | 'none' | undefined; | ||
sameSite?: boolean | "lax" | "strict" | "none" | undefined; | ||
} | ||
@@ -409,5 +404,4 @@ | ||
ReqQuery = ParsedQs, | ||
LocalsObj extends Record<string, any> = Record<string, any> | ||
> extends http.IncomingMessage, | ||
Express.Request { | ||
LocalsObj extends Record<string, any> = Record<string, any>, | ||
> extends http.IncomingMessage, Express.Request { | ||
/** | ||
@@ -432,6 +426,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; | ||
@@ -528,3 +522,2 @@ | ||
* should respond with 4 users when available, not 3. | ||
* | ||
*/ | ||
@@ -658,6 +651,6 @@ range(size: number, options?: RangeParserOptions): RangeParserRanges | RangeParserResult | undefined; | ||
//body: { username: string; password: string; remember: boolean; title: string; }; | ||
// body: { username: string; password: string; remember: boolean; title: string; }; | ||
body: ReqBody; | ||
//cookies: { string; remember: boolean; }; | ||
// cookies: { string; remember: boolean; }; | ||
cookies: any; | ||
@@ -713,5 +706,4 @@ | ||
LocalsObj extends Record<string, any> = Record<string, any>, | ||
StatusCode extends number = number | ||
> extends http.ServerResponse, | ||
Express.Response { | ||
StatusCode extends number = number, | ||
> extends http.ServerResponse, Express.Response { | ||
/** | ||
@@ -969,3 +961,3 @@ * Set status `code`. | ||
/** Get value for header `field`. */ | ||
get(field: string): string|undefined; | ||
get(field: string): string | undefined; | ||
@@ -1068,3 +1060,2 @@ /** Clear cookie `name`. */ | ||
* res.vary('User-Agent').render('docs'); | ||
* | ||
*/ | ||
@@ -1097,8 +1088,9 @@ vary(field: string): this; | ||
export type ApplicationRequestHandler<T> = IRouterHandler<T> & | ||
IRouterMatcher<T> & | ||
((...handlers: RequestHandlerParams[]) => T); | ||
export type ApplicationRequestHandler<T> = | ||
& IRouterHandler<T> | ||
& IRouterMatcher<T> | ||
& ((...handlers: RequestHandlerParams[]) => T); | ||
export interface Application< | ||
LocalsObj extends Record<string, any> = Record<string, any> | ||
LocalsObj extends Record<string, any> = Record<string, any>, | ||
> extends EventEmitter, IRouter, Express.Application { | ||
@@ -1105,0 +1097,0 @@ /** |
{ | ||
"name": "@types/express-serve-static-core", | ||
"version": "4.17.36", | ||
"version": "4.17.37", | ||
"description": "TypeScript definitions for Express", | ||
@@ -53,4 +53,4 @@ "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/express-serve-static-core", | ||
}, | ||
"typesPublisherContentHash": "3498224809b5b549d64382dd3a046fced0f58273994525024be43043bfce7586", | ||
"typeScriptVersion": "4.3" | ||
"typesPublisherContentHash": "4cf131d0413990220a982c55eaefd4457977c30e42f92c975a87630465f6b13c", | ||
"typeScriptVersion": "4.5" | ||
} |
@@ -11,3 +11,3 @@ # Installation | ||
### Additional Details | ||
* Last updated: Tue, 22 Aug 2023 18:04:21 GMT | ||
* Last updated: Sat, 23 Sep 2023 17:07:22 GMT | ||
* Dependencies: [@types/node](https://npmjs.com/package/@types/node), [@types/qs](https://npmjs.com/package/@types/qs), [@types/range-parser](https://npmjs.com/package/@types/range-parser), [@types/send](https://npmjs.com/package/@types/send) | ||
@@ -14,0 +14,0 @@ * Global values: none |
45602
1149