-
-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tmp: testing with supported Promise using augmentation.
- Loading branch information
Anna Bocharova
committed
Sep 10, 2024
1 parent
78e9c0f
commit e2751aa
Showing
1 changed file
with
42 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/** | ||
* @fileOverview Temporary adjustment to the Express 5 type declarations | ||
* @see https://github.com/DefinitelyTyped/DefinitelyTyped/pull/69846/files#diff-5962769e8693df44c9e1083881fb1da149a67262026db939b7430536d514e7af | ||
* */ | ||
/* eslint-disable allowed/dependencies -- this is DTS */ | ||
/* eslint-disable @typescript-eslint/no-explicit-any -- copying as is */ | ||
import { ParsedQs } from "qs"; | ||
import { | ||
NextFunction, | ||
ParamsDictionary, | ||
Request, | ||
Response, | ||
} from "express-serve-static-core"; | ||
|
||
declare module "express-serve-static-core" { | ||
export interface RequestHandler< | ||
P = ParamsDictionary, | ||
ResBody = any, | ||
ReqBody = any, | ||
ReqQuery = ParsedQs, | ||
LocalsObj extends Record<string, any> = Record<string, any>, | ||
> { | ||
( | ||
req: Request<P, ResBody, ReqBody, ReqQuery, LocalsObj>, | ||
res: Response<ResBody, LocalsObj>, | ||
next: NextFunction, | ||
): void | Promise<void>; | ||
} | ||
|
||
export type ErrorRequestHandler< | ||
P = ParamsDictionary, | ||
ResBody = any, | ||
ReqBody = any, | ||
ReqQuery = ParsedQs, | ||
LocalsObj extends Record<string, any> = Record<string, any>, | ||
> = ( | ||
err: any, | ||
req: Request<P, ResBody, ReqBody, ReqQuery, LocalsObj>, | ||
res: Response<ResBody, LocalsObj>, | ||
next: NextFunction, | ||
) => void | Promise<void>; | ||
} |