My current code looks like this:
import { Request, Response, NextFunction } from 'express';
interface IUserRequest extends Request {
user: User;
}
async use(req: IUserRequest, res: Response, next: NextFunction) {
const apiKey: string = String(req.headers['x-api-key']).trim();
However, TypeScript version 3.7.4 is showing an error:
Property 'headers' does not exist on type 'IUserRequest'
.
Can you help me understand what I might be doing wrong?