Skip to content

Commit ba8a099

Browse files
committed
chore(aws-lambda): update types
1 parent a01d4e4 commit ba8a099

File tree

1 file changed

+2
-30
lines changed

1 file changed

+2
-30
lines changed

src/presets/aws-lambda/runtime/aws-lambda-streaming.ts

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
import type { Readable } from "node:stream";
2-
import type {
3-
APIGatewayProxyEventV2,
4-
APIGatewayProxyStructuredResultV2,
5-
Context,
6-
} from "aws-lambda";
2+
import type { APIGatewayProxyEventV2 } from "aws-lambda";
73
import "#nitro-internal-pollyfills";
84
import { useNitroApp } from "nitropack/runtime";
95
import {
@@ -59,6 +55,7 @@ export const handler = awslambda.streamifyResponse(
5955
};
6056
if (r.body) {
6157
const writer = awslambda.HttpResponseStream.from(
58+
// @ts-expect-error TODO: IMPORTANT! It should be a Writable according to the aws-lambda types
6259
responseStream,
6360
httpResponseMetadata
6461
);
@@ -85,28 +82,3 @@ async function streamToNodeStream(
8582
}
8683
writer.end();
8784
}
88-
89-
declare global {
90-
// eslint-disable-next-line @typescript-eslint/no-namespace
91-
namespace awslambda {
92-
// https://docs.aws.amazon.com/lambda/latest/dg/configuration-response-streaming.html
93-
function streamifyResponse(
94-
handler: (
95-
event: APIGatewayProxyEventV2,
96-
responseStream: NodeJS.WritableStream,
97-
context: Context
98-
) => Promise<void>
99-
): any;
100-
101-
// eslint-disable-next-line @typescript-eslint/no-namespace
102-
namespace HttpResponseStream {
103-
function from(
104-
stream: NodeJS.WritableStream,
105-
metadata: {
106-
statusCode: APIGatewayProxyStructuredResultV2["statusCode"];
107-
headers: APIGatewayProxyStructuredResultV2["headers"];
108-
}
109-
): NodeJS.WritableStream;
110-
}
111-
}
112-
}

0 commit comments

Comments
 (0)