This PR adds generic type arguments to streamifyResponse, so that handlers with different event types can be used (not only APIGatewayProxyEventV2).
The event payload for a Lambda function can have different types depending on how the function is called. When a function is called using the Invoke API, it could be an entirely arbitrary object.
I've also renamed RequestHandler to StreamingHandler. This seems more correct to me since an invocation is not necessarily the same as an HTTP request, and is more in line with the naming of the Handler type in @types/aws-lambda. An exported type alias of RequestHandler = StreamingHandler<APIGatewayProxyEventV2> is provided for backwards compatibility.
This PR adds generic type arguments to
streamifyResponse
, so that handlers with different event types can be used (not onlyAPIGatewayProxyEventV2
).The
event
payload for a Lambda function can have different types depending on how the function is called. When a function is called using the Invoke API, it could be an entirely arbitrary object.I've also renamed
RequestHandler
toStreamingHandler
. This seems more correct to me since an invocation is not necessarily the same as an HTTP request, and is more in line with the naming of theHandler
type in @types/aws-lambda. An exported type alias ofRequestHandler = StreamingHandler<APIGatewayProxyEventV2>
is provided for backwards compatibility.Fixes #16