Skip to content

Commit

Permalink
types: declare global awslambda stream APIs
Browse files Browse the repository at this point in the history
  • Loading branch information
NamesMT committed Jul 19, 2024
1 parent f373710 commit 4d28a32
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/@types/awslambda/index.d.ts
Original file line number Diff line number Diff line change
@@ -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<any>

export function streamifyResponse(handler: StreamifyHandler): Handler<APIGatewayProxyEventV2>
}
}

0 comments on commit 4d28a32

Please sign in to comment.