Skip to content

Commit

Permalink
fix: types for Request and Response (#1271)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-akait committed May 18, 2022
1 parent 1a45388 commit eeb8aa8
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 14 deletions.
32 changes: 26 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@
"standard-version": "^9.3.0",
"strip-ansi": "^6.0.0",
"supertest": "^6.1.3",
"typescript": "4.5.5",
"webpack": "^5.68.0"
},
"keywords": [
Expand Down
17 changes: 9 additions & 8 deletions types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ type Options<
| undefined;
writeToDisk?: boolean | ((targetPath: string) => boolean) | undefined;
methods?: string | undefined;
headers?: Headers<Request, Response>;
headers?: Headers<Request_1, Response_1>;
publicPath?: NonNullable<Configuration["output"]>["publicPath"];
stats?: Configuration["stats"];
serverSideRender?: boolean | undefined;
Expand All @@ -175,7 +175,8 @@ type Options<
type API<
Request_1 extends import("http").IncomingMessage,
Response_1 extends ServerResponse
> = Middleware<Request, Response> & AdditionalMethods<Request, Response>;
> = Middleware<Request_1, Response_1> &
AdditionalMethods<Request_1, Response_1>;
type Schema = import("schema-utils/declarations/validate").Schema;
type Configuration = import("webpack").Configuration;
type Stats = import("webpack").Stats;
Expand Down Expand Up @@ -215,7 +216,7 @@ type Context<
state: boolean;
stats: Stats | MultiStats | undefined;
callbacks: Callback[];
options: Options<Request, Response>;
options: Options<Request_1, Response_1>;
compiler: Compiler | MultiCompiler;
watching: Watching | MultiWatching;
logger: Logger;
Expand All @@ -231,15 +232,15 @@ type Headers<
value: number | string;
}[]
| ((
req: Request,
res: Response,
context: Context<Request, Response>
req: Request_1,
res: Response_1,
context: Context<Request_1, Response_1>
) => void | undefined | Record<string, string | number>)
| undefined;
type Middleware<
Request_1 extends import("http").IncomingMessage,
Response_1 extends ServerResponse
> = (req: Request, res: Response, next: NextFunction) => Promise<void>;
> = (req: Request_1, res: Response_1, next: NextFunction) => Promise<void>;
type GetFilenameFromUrl = (url: string) => string | undefined;
type WaitUntilValid = (callback: Callback) => any;
type Invalidate = (callback: Callback) => any;
Expand All @@ -252,5 +253,5 @@ type AdditionalMethods<
waitUntilValid: WaitUntilValid;
invalidate: Invalidate;
close: Close;
context: Context<Request, Response>;
context: Context<Request_1, Response_1>;
};

0 comments on commit eeb8aa8

Please sign in to comment.