Expected Behavior
When you define a route using the app.route with a handler that uses the reqCtx object it should be of type of RequestContext or TypedRequestContext.
Current Behavior
Currently when you try to access the context object you get a typescript error: Parameter 'reqCtx' implicitly has an 'any' type.
Code snippet
const app = new Router();
app.route(({req}) => { // <- type error
return req;
}, {
path: '/test',
method: [HttpVerbs.GET, HttpVerbs.POST],
});
Steps to Reproduce
Create a simple handler like the code example above that interacts with the request context object in any way and you will see the error.
Possible Solution
The issue is that we are missing a method overload on the route method that the other HTTP handlers have that tell the compiler that reqCtx is of type RequestContext when there is no validation options object and TypedRequestContext when it is present.
Powertools for AWS Lambda (TypeScript) version
latest
AWS Lambda function runtime
24.x
Packaging format used
npm
Execution logs
Expected Behavior
When you define a route using the
app.routewith a handler that uses thereqCtxobject it should be of type ofRequestContextorTypedRequestContext.Current Behavior
Currently when you try to access the context object you get a typescript error:
Parameter 'reqCtx' implicitly has an 'any' type.Code snippet
Steps to Reproduce
Create a simple handler like the code example above that interacts with the request context object in any way and you will see the error.
Possible Solution
The issue is that we are missing a method overload on the
routemethod that the other HTTP handlers have that tell the compiler thatreqCtxis of typeRequestContextwhen there is no validation options object andTypedRequestContextwhen it is present.Powertools for AWS Lambda (TypeScript) version
latest
AWS Lambda function runtime
24.x
Packaging format used
npm
Execution logs