From 42cbc879bf4a01e6f581878579534eb8e843c9b3 Mon Sep 17 00:00:00 2001 From: chimurai <655241+chimurai@users.noreply.github.com> Date: Sun, 23 Jan 2022 16:03:39 +0100 Subject: [PATCH] fix(types): fix type regression --- package.json | 3 +++ src/types.ts | 20 ++++++++------------ 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/package.json b/package.json index 7e79cb2f..8fcfa2db 100644 --- a/package.json +++ b/package.json @@ -90,6 +90,9 @@ "is-plain-obj": "^3.0.0", "micromatch": "^4.0.2" }, + "peerDependencies": { + "@types/express": "^4.17.13" + }, "engines": { "node": ">=12.0.0" }, diff --git a/src/types.ts b/src/types.ts index 767a5688..55628aab 100644 --- a/src/types.ts +++ b/src/types.ts @@ -58,32 +58,28 @@ export type LogProviderCallback = (provider: LogProvider) => LogProvider; */ export type OnErrorCallback = ( err: Error, - req: http.IncomingMessage, - res: http.ServerResponse, + req: Request, + res: Response, target?: string | Partial ) => void; export type OnProxyResCallback = ( proxyRes: http.IncomingMessage, - req: http.IncomingMessage, - res: http.ServerResponse + req: Request, + res: Response ) => void; export type OnProxyReqCallback = ( proxyReq: http.ClientRequest, - req: http.IncomingMessage, - res: http.ServerResponse, + req: Request, + res: Response, options: httpProxy.ServerOptions ) => void; export type OnProxyReqWsCallback = ( proxyReq: http.ClientRequest, - req: http.IncomingMessage, + req: Request, socket: net.Socket, options: httpProxy.ServerOptions, head: any ) => void; -export type OnCloseCallback = ( - proxyRes: http.IncomingMessage, - proxySocket: net.Socket, - proxyHead: any -) => void; +export type OnCloseCallback = (proxyRes: Response, proxySocket: net.Socket, proxyHead: any) => void; export type OnOpenCallback = (proxySocket: net.Socket) => void;