mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-26 19:04:13 +08:00
Fix type of createPushResponse() in node http2. (#20510)
* Fix type of createPushResponse() in node http2. From https://github.com/nodejs/node/blob/master/lib/internal/http2/compat.js#L628: `callback` is required to be a function. And its second argument is an `Http2ServerResponse`. * `err` is nullable. * delete redundant tests that have partial arguments
This commit is contained in:
2
types/node/index.d.ts
vendored
2
types/node/index.d.ts
vendored
@@ -6616,7 +6616,7 @@ declare module "http2" {
|
||||
writeContinue(): void;
|
||||
writeHead(statusCode: number, headers?: OutgoingHttpHeaders): void;
|
||||
writeHead(statusCode: number, statusMessage?: string, headers?: OutgoingHttpHeaders): void;
|
||||
createPushResponse(headers: OutgoingHttpHeaders, callback?: (err: Error) => void): void;
|
||||
createPushResponse(headers: OutgoingHttpHeaders, callback: (err: Error | null, res: Http2ServerResponse) => void): void;
|
||||
|
||||
addListener(event: string, listener: (...args: any[]) => void): this;
|
||||
addListener(event: "aborted", listener: (hadError: boolean, code: number) => void): this;
|
||||
|
||||
@@ -3353,8 +3353,7 @@ namespace http2_tests {
|
||||
let headersSent: boolean = response.headersSent;
|
||||
|
||||
response.setTimeout(0, () => {});
|
||||
response.createPushResponse(outgoingHeaders);
|
||||
response.createPushResponse(outgoingHeaders, (err: Error) => {});
|
||||
response.createPushResponse(outgoingHeaders, (err: Error | null, res: http2.Http2ServerResponse) => {});
|
||||
|
||||
response.writeContinue();
|
||||
response.writeHead(200);
|
||||
|
||||
Reference in New Issue
Block a user