The npm package @types/aws-lambda
provides TypeScript declarations for different ways Lambda functions can be triggered. For instance, when triggering the Lambda function through API Gateway, you can use the following code snippet:
import { APIGatewayProxyHandler } from "aws-lambda";
export const handler: APIGatewayProxyHandler = async (
event,
context,
callback
) => {
...
}
Using this code snippet ensures that event
, context
, and callback
have the correct types.
Can you provide the equivalent code if the handler is triggered via Lambda Function URLs?