Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: types for request and response #1271

Merged
merged 1 commit into from
May 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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>;
};