Skip to content

Commit 277b8a3

Browse files
committedNov 26, 2024·
fix(@angular/ssr): ensure compatibility for Http2ServerResponse type
Updated the `Http2ServerResponse` interface to eliminate dependency on generics, ensuring compatibility across multiple versions of `@types/node`. Closes #28965 (cherry picked from commit 3dd3b22)
1 parent ab4e77c commit 277b8a3

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed
 

‎goldens/public-api/angular/ssr/node/index.api.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export function isMainModule(url: string): boolean;
5757
export type NodeRequestHandlerFunction = (req: IncomingMessage, res: ServerResponse, next: (err?: unknown) => void) => Promise<void> | void;
5858

5959
// @public
60-
export function writeResponseToNodeResponse(source: Response, destination: ServerResponse | Http2ServerResponse<Http2ServerRequest>): Promise<void>;
60+
export function writeResponseToNodeResponse(source: Response, destination: ServerResponse | Http2ServerResponse): Promise<void>;
6161

6262
// (No @packageDocumentation comment for this package)
6363

‎packages/angular/ssr/node/src/response.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*/
88

99
import type { ServerResponse } from 'node:http';
10-
import type { Http2ServerRequest, Http2ServerResponse } from 'node:http2';
10+
import type { Http2ServerResponse } from 'node:http2';
1111

1212
/**
1313
* Streams a web-standard `Response` into a Node.js `ServerResponse`
@@ -23,7 +23,7 @@ import type { Http2ServerRequest, Http2ServerResponse } from 'node:http2';
2323
*/
2424
export async function writeResponseToNodeResponse(
2525
source: Response,
26-
destination: ServerResponse | Http2ServerResponse<Http2ServerRequest>,
26+
destination: ServerResponse | Http2ServerResponse,
2727
): Promise<void> {
2828
const { status, headers, body } = source;
2929
destination.statusCode = status;

‎packages/angular/ssr/node/test/request_http2_spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ describe('createWebRequestFromNodeRequest (HTTP/2)', () => {
3232
async function getNodeRequest(): Promise<Http2ServerRequest> {
3333
const { req, res } = await new Promise<{
3434
req: Http2ServerRequest;
35-
res: Http2ServerResponse<Http2ServerRequest>;
35+
res: Http2ServerResponse;
3636
}>((resolve) => {
3737
server.once('request', (req, res) => resolve({ req, res }));
3838
});

0 commit comments

Comments
 (0)
Please sign in to comment.