Skip to content

Commit

Permalink
fix(@angular/ssr): ensure compatibility for Http2ServerResponse type
Browse files Browse the repository at this point in the history
Updated the `Http2ServerResponse` interface to eliminate dependency on generics, ensuring compatibility across multiple versions of `@types/node`.

Closes #28965
  • Loading branch information
alan-agius4 committed Nov 26, 2024
1 parent 18041aa commit 3dd3b22
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion goldens/public-api/angular/ssr/node/index.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export function isMainModule(url: string): boolean;
export type NodeRequestHandlerFunction = (req: IncomingMessage, res: ServerResponse, next: (err?: unknown) => void) => Promise<void> | void;

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

// (No @packageDocumentation comment for this package)

Expand Down
4 changes: 2 additions & 2 deletions packages/angular/ssr/node/src/response.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand All @@ -23,7 +23,7 @@ import type { Http2ServerRequest, Http2ServerResponse } from 'node:http2';
*/
export async function writeResponseToNodeResponse(
source: Response,
destination: ServerResponse | Http2ServerResponse<Http2ServerRequest>,
destination: ServerResponse | Http2ServerResponse,
): Promise<void> {
const { status, headers, body } = source;
destination.statusCode = status;
Expand Down
2 changes: 1 addition & 1 deletion packages/angular/ssr/node/test/request_http2_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ describe('createWebRequestFromNodeRequest (HTTP/2)', () => {
async function getNodeRequest(): Promise<Http2ServerRequest> {
const { req, res } = await new Promise<{
req: Http2ServerRequest;
res: Http2ServerResponse<Http2ServerRequest>;
res: Http2ServerResponse;
}>((resolve) => {
server.once('request', (req, res) => resolve({ req, res }));
});
Expand Down

0 comments on commit 3dd3b22

Please sign in to comment.