From 1aa2a083652b65c6457591a0cf50dbf81d630bc9 Mon Sep 17 00:00:00 2001 From: Alan Agius Date: Tue, 26 Nov 2024 07:30:57 +0000 Subject: [PATCH] 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 --- goldens/public-api/angular/ssr/node/index.api.md | 2 +- packages/angular/ssr/node/src/response.ts | 4 ++-- packages/angular/ssr/node/test/request_http2_spec.ts | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/goldens/public-api/angular/ssr/node/index.api.md b/goldens/public-api/angular/ssr/node/index.api.md index 6488d0f363dd..0bbeb8ae145a 100644 --- a/goldens/public-api/angular/ssr/node/index.api.md +++ b/goldens/public-api/angular/ssr/node/index.api.md @@ -57,7 +57,7 @@ export function isMainModule(url: string): boolean; export type NodeRequestHandlerFunction = (req: IncomingMessage, res: ServerResponse, next: (err?: unknown) => void) => Promise | void; // @public -export function writeResponseToNodeResponse(source: Response, destination: ServerResponse | Http2ServerResponse): Promise; +export function writeResponseToNodeResponse(source: Response, destination: ServerResponse | Http2ServerResponse): Promise; // (No @packageDocumentation comment for this package) diff --git a/packages/angular/ssr/node/src/response.ts b/packages/angular/ssr/node/src/response.ts index 936693c2b168..c3f397a83bb4 100644 --- a/packages/angular/ssr/node/src/response.ts +++ b/packages/angular/ssr/node/src/response.ts @@ -7,7 +7,7 @@ */ import type { ServerResponse } from 'node:http'; -import type { Http2ServerRequest, Http2ServerResponse } from 'node:http2'; +import type { Http2ServerResponse } from 'node:http2'; /** * Streams a web-standard `Response` into a Node.js `ServerResponse` @@ -23,7 +23,7 @@ import type { Http2ServerRequest, Http2ServerResponse } from 'node:http2'; */ export async function writeResponseToNodeResponse( source: Response, - destination: ServerResponse | Http2ServerResponse, + destination: ServerResponse | Http2ServerResponse, ): Promise { const { status, headers, body } = source; destination.statusCode = status; diff --git a/packages/angular/ssr/node/test/request_http2_spec.ts b/packages/angular/ssr/node/test/request_http2_spec.ts index 61f12eada863..4d9754d20cfc 100644 --- a/packages/angular/ssr/node/test/request_http2_spec.ts +++ b/packages/angular/ssr/node/test/request_http2_spec.ts @@ -32,7 +32,7 @@ describe('createWebRequestFromNodeRequest (HTTP/2)', () => { async function getNodeRequest(): Promise { const { req, res } = await new Promise<{ req: Http2ServerRequest; - res: Http2ServerResponse; + res: Http2ServerResponse; }>((resolve) => { server.once('request', (req, res) => resolve({ req, res })); });