Skip to content

Commit eeb8aa8

Browse files
authoredMay 18, 2022
fix: types for Request and Response (#1271)
1 parent 1a45388 commit eeb8aa8

File tree

3 files changed

+36
-14
lines changed

3 files changed

+36
-14
lines changed
 

‎package-lock.json

+26-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json

+1
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@
8585
"standard-version": "^9.3.0",
8686
"strip-ansi": "^6.0.0",
8787
"supertest": "^6.1.3",
88+
"typescript": "4.5.5",
8889
"webpack": "^5.68.0"
8990
},
9091
"keywords": [

‎types/index.d.ts

+9-8
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ type Options<
165165
| undefined;
166166
writeToDisk?: boolean | ((targetPath: string) => boolean) | undefined;
167167
methods?: string | undefined;
168-
headers?: Headers<Request, Response>;
168+
headers?: Headers<Request_1, Response_1>;
169169
publicPath?: NonNullable<Configuration["output"]>["publicPath"];
170170
stats?: Configuration["stats"];
171171
serverSideRender?: boolean | undefined;
@@ -175,7 +175,8 @@ type Options<
175175
type API<
176176
Request_1 extends import("http").IncomingMessage,
177177
Response_1 extends ServerResponse
178-
> = Middleware<Request, Response> & AdditionalMethods<Request, Response>;
178+
> = Middleware<Request_1, Response_1> &
179+
AdditionalMethods<Request_1, Response_1>;
179180
type Schema = import("schema-utils/declarations/validate").Schema;
180181
type Configuration = import("webpack").Configuration;
181182
type Stats = import("webpack").Stats;
@@ -215,7 +216,7 @@ type Context<
215216
state: boolean;
216217
stats: Stats | MultiStats | undefined;
217218
callbacks: Callback[];
218-
options: Options<Request, Response>;
219+
options: Options<Request_1, Response_1>;
219220
compiler: Compiler | MultiCompiler;
220221
watching: Watching | MultiWatching;
221222
logger: Logger;
@@ -231,15 +232,15 @@ type Headers<
231232
value: number | string;
232233
}[]
233234
| ((
234-
req: Request,
235-
res: Response,
236-
context: Context<Request, Response>
235+
req: Request_1,
236+
res: Response_1,
237+
context: Context<Request_1, Response_1>
237238
) => void | undefined | Record<string, string | number>)
238239
| undefined;
239240
type Middleware<
240241
Request_1 extends import("http").IncomingMessage,
241242
Response_1 extends ServerResponse
242-
> = (req: Request, res: Response, next: NextFunction) => Promise<void>;
243+
> = (req: Request_1, res: Response_1, next: NextFunction) => Promise<void>;
243244
type GetFilenameFromUrl = (url: string) => string | undefined;
244245
type WaitUntilValid = (callback: Callback) => any;
245246
type Invalidate = (callback: Callback) => any;
@@ -252,5 +253,5 @@ type AdditionalMethods<
252253
waitUntilValid: WaitUntilValid;
253254
invalidate: Invalidate;
254255
close: Close;
255-
context: Context<Request, Response>;
256+
context: Context<Request_1, Response_1>;
256257
};

0 commit comments

Comments
 (0)
Please sign in to comment.