I'm currently setting up a NestJS controller and have been using any
as the type for the request. Is there a more precise type I could use to ensure stronger typing?
@Controller('endpoint')
@UsePipes(new MongoSanitizePipe())
export class RequestController {
constructor(private service: Service) {}
@Post('post')
async onAction(
@Body() body: RequestBody,
@Request() request: any,
): Promise<void> {
return this.service.onAction(body, request.headers);
}
}
What experimentation have you done and what outcome were you expecting?
I've searched for a specific HttpRequest type without success.
I hoped to find a way to properly define its type.