diff --git a/src/@types/awslambda/index.d.ts b/src/@types/awslambda/index.d.ts new file mode 100644 index 0000000..8b2caf5 --- /dev/null +++ b/src/@types/awslambda/index.d.ts @@ -0,0 +1,17 @@ +import type { APIGatewayProxyEventV2, Context, Handler } from 'aws-lambda' + +declare global { + namespace awslambda { + export namespace HttpResponseStream { + function from(writable: NodeJS.WritableStream, metadata: any): NodeJS.WritableStream + } + + export type ResponseStream = NodeJS.WritableStream & { + setContentType: (type: string) => void + } + + export type StreamifyHandler = (event: APIGatewayProxyEventV2, responseStream: ResponseStream, context: Context) => Promise + + export function streamifyResponse(handler: StreamifyHandler): Handler + } +}